Update commands.

Commands will now call correct GUI.
This commit is contained in:
BONNe 2021-09-18 13:00:31 +03:00
parent d1f15aed8b
commit bfc5cefd69
4 changed files with 22 additions and 25 deletions

View File

@ -6,7 +6,7 @@ import world.bentobox.bentobox.api.addons.GameModeAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.challenges.ChallengesAddon;
import world.bentobox.challenges.panel.user.ChallengesGUI;
import world.bentobox.challenges.panel.user.ChallengesPanel;
public class ChallengesCommand extends CompositeCommand
@ -70,11 +70,12 @@ public class ChallengesCommand extends CompositeCommand
// Open up the challenges GUI
if (user.isPlayer())
{
new ChallengesGUI((ChallengesAddon) this.getAddon(),
this.getWorld(),
user,
this.getTopLabel(),
this.getPermissionPrefix()).build();
ChallengesPanel.open(this.getAddon(),
this.getWorld(),
user,
this.getTopLabel(),
this.getPermissionPrefix());
return true;
}
// Show help

View File

@ -8,7 +8,7 @@ import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.challenges.ChallengesAddon;
import world.bentobox.challenges.config.SettingsUtils.GuiMode;
import world.bentobox.challenges.panel.GameModesGUI;
import world.bentobox.challenges.panel.user.GameModePanel;
/**
@ -75,13 +75,11 @@ public class ChallengesUserCommand extends CompositeCommand
}
else if (this.addon.getChallengesSettings().getUserGuiMode() == GuiMode.GAMEMODE_LIST)
{
new GameModesGUI(this.addon,
GameModePanel.open(this.addon,
this.getWorld(),
user,
this.getTopLabel(),
this.getPermissionPrefix(),
false,
this.gameModeAddons).build();
this.gameModeAddons,
false);
return true;
}
@ -97,10 +95,10 @@ public class ChallengesUserCommand extends CompositeCommand
/**
* List with hooked GameMode addons.
*/
private List<GameModeAddon> gameModeAddons;
private final List<GameModeAddon> gameModeAddons;
/**
* Challenges addon for easier operations.
*/
private ChallengesAddon addon;
private final ChallengesAddon addon;
}

View File

@ -5,7 +5,7 @@ import java.util.List;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.challenges.ChallengesAddon;
import world.bentobox.challenges.panel.admin.AdminGUI;
import world.bentobox.challenges.panel.admin.AdminPanel;
public class Challenges extends CompositeCommand
@ -55,11 +55,11 @@ public class Challenges extends CompositeCommand
// Open up the admin challenges GUI
if (user.isPlayer())
{
new AdminGUI((ChallengesAddon) this.getAddon(),
AdminPanel.open(this.getAddon(),
this.getWorld(),
user,
this.getTopLabel(),
this.getPermissionPrefix()).build();
this.getPermissionPrefix());
return true;
}

View File

@ -7,7 +7,7 @@ import world.bentobox.bentobox.api.addons.GameModeAddon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.challenges.ChallengesAddon;
import world.bentobox.challenges.panel.GameModesGUI;
import world.bentobox.challenges.panel.user.GameModePanel;
/**
@ -58,13 +58,11 @@ public class ChallengesAdminCommand extends CompositeCommand
}
else
{
new GameModesGUI(this.addon,
GameModePanel.open(this.addon,
this.getWorld(),
user,
this.getTopLabel(),
this.getPermissionPrefix(),
true,
this.gameModeAddons).build();
this.gameModeAddons,
true);
}
return true;
@ -78,10 +76,10 @@ public class ChallengesAdminCommand extends CompositeCommand
/**
* This variable stores challenges addon.
*/
private ChallengesAddon addon;
private final ChallengesAddon addon;
/**
* This variable stores List with game modes where challenges addon are hooked in.
*/
private List<GameModeAddon> gameModeAddons;
private final List<GameModeAddon> gameModeAddons;
}