Skip to content

Commit

Permalink
Implement existing GUIs in EditLevelGUI.
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed Jan 18, 2019
1 parent 1b1b081 commit 6cdc619
Showing 1 changed file with 58 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
import world.bentobox.challenges.database.object.ChallengeLevels;
import world.bentobox.challenges.database.object.Challenges;
import world.bentobox.challenges.panel.CommonGUI;
import world.bentobox.challenges.panel.util.ItemSwitchGUI;
import world.bentobox.challenges.panel.util.NumberGUI;
import world.bentobox.challenges.panel.util.StringListGUI;


/**
Expand Down Expand Up @@ -72,7 +75,7 @@ public EditLevelGUI(ChallengesAddon addon,
@Override
public void build()
{
PanelBuilder panelBuilder = new PanelBuilder().name(
PanelBuilder panelBuilder = new PanelBuilder().user(this.user).name(
this.user.getTranslation("challenges.gui.admin.edit-level-title"));

panelBuilder.item(2, this.createMenuButton(MenuType.PROPERTIES));
Expand Down Expand Up @@ -289,7 +292,7 @@ private PanelItem createButton(Button button)
description = Collections.singletonList(this.challengeLevel.getFriendlyName());
icon = new ItemStack(Material.DROPPER);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create naming
// TODO: Implement AnvilGui.
this.build();

return true;
Expand Down Expand Up @@ -317,7 +320,7 @@ private PanelItem createButton(Button button)
description = Collections.singletonList(this.challengeLevel.getUnlockMessage());
icon = new ItemStack(Material.WRITABLE_BOOK);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Implement challenges description change GUI.
// TODO: Implement AnvilGUI
this.build();
return true;
};
Expand All @@ -333,8 +336,14 @@ private PanelItem createButton(Button button)
Integer.toString(this.challengeLevel.getOrder())));
icon = new ItemStack(Material.DROPPER);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Possibility to change order.
this.build();
new NumberGUI(this.user, this.challengeLevel.getOrder(), -1, 54, (status, value) -> {
if (status)
{
this.challengeLevel.setOrder(value);
}

this.build();
});

return true;
};
Expand All @@ -350,8 +359,14 @@ private PanelItem createButton(Button button)
Integer.toString(this.challengeLevel.getWaiveramount())));
icon = new ItemStack(Material.REDSTONE_TORCH);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Possibility to change order.
this.build();
new NumberGUI(this.user, this.challengeLevel.getWaiveramount(), 0, (status, value) -> {
if (status)
{
this.challengeLevel.setWaiveramount(value);
}

this.build();
});

return true;
};
Expand All @@ -365,8 +380,8 @@ private PanelItem createButton(Button button)
description = Collections.singletonList(this.challengeLevel.getRewardDescription());
icon = new ItemStack(Material.WRITTEN_BOOK);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Implement challenges description change GUI.
this.build();
// TODO: Implement AnvilGui

return true;
};
glow = false;
Expand All @@ -385,8 +400,14 @@ private PanelItem createButton(Button button)
description = values;
icon = new ItemStack(Material.CHEST);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create Panel
this.build();
new ItemSwitchGUI(this.user, this.challengeLevel.getRewardItems(), (status, value) -> {
if (status)
{
this.challengeLevel.setRewardItems(value);
}

this.build();
});

return true;
};
Expand All @@ -402,8 +423,14 @@ private PanelItem createButton(Button button)
Integer.toString(this.challengeLevel.getExpReward())));
icon = new ItemStack(Material.EXPERIENCE_BOTTLE);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Possibility to change order.
this.build();
new NumberGUI(this.user, this.challengeLevel.getExpReward(), 0, (status, value) -> {
if (status)
{
this.challengeLevel.setExpReward(value);
}

this.build();
});

return true;
};
Expand All @@ -419,8 +446,14 @@ private PanelItem createButton(Button button)
Integer.toString(this.challengeLevel.getMoneyReward())));
icon = new ItemStack(Material.GOLD_INGOT);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Possibility to change order.
this.build();
new NumberGUI(this.user, this.challengeLevel.getMoneyReward(), 0, (status, value) -> {
if (status)
{
this.challengeLevel.setMoneyReward(value);
}

this.build();
});

return true;
};
Expand All @@ -433,8 +466,14 @@ private PanelItem createButton(Button button)
description = this.challengeLevel.getRewardCommands();
icon = new ItemStack(Material.COMMAND_BLOCK);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create naming
this.build();
new StringListGUI(this.user, this.challengeLevel.getRewardCommands(), (status, value) -> {
if (status)
{
this.challengeLevel.setRewardCommands(value);
}

this.build();
});

return true;
};
Expand All @@ -448,7 +487,7 @@ private PanelItem createButton(Button button)
description = Collections.emptyList();
icon = new ItemStack(Material.WATER_BUCKET);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create naming
// TODO: Create Challenge List GUI
this.build();

return true;
Expand All @@ -462,7 +501,7 @@ private PanelItem createButton(Button button)
description = Collections.emptyList();
icon = new ItemStack(Material.LAVA_BUCKET);
clickHandler = (panel, user, clickType, slot) -> {
// TODO: Create naming
// TODO: Create Levels List GUI
this.build();

return true;
Expand Down

0 comments on commit 6cdc619

Please sign in to comment.