Skip to content

Commit

Permalink
Implement existing GUIs in AdminGUI. Update TODO comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed Jan 17, 2019
1 parent dab5f2b commit 29dadf3
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 11 deletions.
70 changes: 60 additions & 10 deletions src/main/java/world/bentobox/challenges/panel/admin/AdminGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.inventory.ItemStack;

import java.util.Collections;
import java.util.List;

Expand All @@ -29,6 +28,11 @@ public class AdminGUI extends CommonGUI
*/
private boolean overwriteMode;

/**
* This indicate if Reset Challenges must work as reset all.
*/
private boolean resetAllMode;


// ---------------------------------------------------------------------
// Section: Enums
Expand Down Expand Up @@ -135,7 +139,13 @@ private PanelItem createButton(Button button)
description = Collections.emptyList();
icon = new ItemStack(Material.WRITTEN_BOOK);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create Complete Challenge GUI
new ListUsersGUI(this.addon,
this.world,
this.user,
ListUsersGUI.Mode.COMPLETE,
this.topLabel,
this.permissionPrefix,
this).build();

return true;
};
Expand All @@ -148,12 +158,28 @@ private PanelItem createButton(Button button)
name = this.user.getTranslation("challenges.gui.admin.buttons.reset");
description = Collections.emptyList();
icon = new ItemStack(Material.WRITABLE_BOOK);

glow = this.resetAllMode;

clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create Reset Challenge GUI
if (clickType.isRightClick())
{
this.resetAllMode = !this.resetAllMode;
this.build();
}
else
{
new ListUsersGUI(this.addon,
this.world,
this.user,
this.resetAllMode ? ListUsersGUI.Mode.RESET_ALL : ListUsersGUI.Mode.RESET,
this.topLabel,
this.permissionPrefix,
this).build();
}

return true;
};
glow = false;

break;
case ADD_CHALLENGE:
Expand All @@ -163,7 +189,7 @@ private PanelItem createButton(Button button)
description = Collections.emptyList();
icon = new ItemStack(Material.BOOK);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create Add Challenge GUI
// TODO: Create AnvilGUI that force to create String for "unique_id"

return true;
};
Expand All @@ -177,7 +203,7 @@ private PanelItem createButton(Button button)
description = Collections.emptyList();
icon = new ItemStack(Material.BOOK);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create Add Level GUI
// TODO: Create AnvilGUI that force to create String for "unique_id"

return true;
};
Expand All @@ -191,7 +217,13 @@ private PanelItem createButton(Button button)
description = Collections.emptyList();
icon = new ItemStack(Material.ANVIL);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create Edit Challenge GUI
new ListChallengesGUI(this.addon,
this.world,
this.user,
ListChallengesGUI.Mode.EDIT,
this.topLabel,
this.permissionPrefix,
this);

return true;
};
Expand All @@ -206,7 +238,13 @@ private PanelItem createButton(Button button)
description = Collections.emptyList();
icon = new ItemStack(Material.ANVIL);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create Edit Level GUI
new ListLevelsGUI(this.addon,
this.world,
this.user,
ListLevelsGUI.Mode.EDIT,
this.topLabel,
this.permissionPrefix,
this);

return true;
};
Expand All @@ -222,7 +260,13 @@ private PanelItem createButton(Button button)
description = Collections.emptyList();
icon = new ItemStack(Material.LAVA_BUCKET);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create Delete Challenge GUI
new ListChallengesGUI(this.addon,
this.world,
this.user,
ListChallengesGUI.Mode.DELETE,
this.topLabel,
this.permissionPrefix,
this);

return true;
};
Expand All @@ -238,7 +282,13 @@ private PanelItem createButton(Button button)
description = Collections.emptyList();
icon = new ItemStack(Material.LAVA_BUCKET);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create Delete Level GUI
new ListLevelsGUI(this.addon,
this.world,
this.user,
ListLevelsGUI.Mode.DELETE,
this.topLabel,
this.permissionPrefix,
this);

return true;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private enum ViewMode
/**
* This allows to decide what User Icon should do.
*/
private enum Mode
public enum Mode
{
COMPLETE,
RESET,
Expand Down

0 comments on commit 29dadf3

Please sign in to comment.