Skip to content

Commit

Permalink
Update commands.
Browse files Browse the repository at this point in the history
Commands will now call correct GUI.
  • Loading branch information
BONNe committed Sep 18, 2021
1 parent d1f15ae commit bfc5cef
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
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
Expand Down Expand Up @@ -70,11 +70,12 @@ public boolean execute(User user, String label, List<String> args)
// 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
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;


/**
Expand Down Expand Up @@ -75,13 +75,11 @@ else if (this.addon.getChallengesSettings().getUserGuiMode() == GuiMode.CURRENT_
}
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;
}

Expand All @@ -97,10 +95,10 @@ else if (this.addon.getChallengesSettings().getUserGuiMode() == GuiMode.GAMEMODE
/**
* 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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
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
Expand Down Expand Up @@ -55,11 +55,11 @@ public boolean execute(User user, String label, List<String> args)
// 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
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;


/**
Expand Down Expand Up @@ -58,13 +58,11 @@ public boolean execute(User user, String label, List<String> args)
}
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;
Expand All @@ -78,10 +76,10 @@ public boolean execute(User user, String label, List<String> args)
/**
* 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;
}

0 comments on commit bfc5cef

Please sign in to comment.