Skip to content

Commit

Permalink
Add Single GUI enabling button in Settings GUI.
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed Mar 5, 2019
1 parent c737c87 commit 6bf439c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,16 @@ public void build()
panelBuilder.item(20, this.getSettingsButton(Button.GLOW_COMPLETED));
panelBuilder.item(29, this.getSettingsButton(Button.REMOVE_COMPLETED));

panelBuilder.item(12, this.getSettingsButton(Button.LOCKED_LEVEL_ICON));
panelBuilder.item(21, this.getSettingsButton(Button.FREE_AT_TOP));
panelBuilder.item(30, this.getSettingsButton(Button.GAMEMODE_GUI));
panelBuilder.item(21, this.getSettingsButton(Button.LOCKED_LEVEL_ICON));
panelBuilder.item(30, this.getSettingsButton(Button.FREE_AT_TOP));

panelBuilder.item(22, this.getSettingsButton(Button.GAMEMODE_GUI));

if (this.settings.isUseCommonGUI())
{
// This should be active only when single gui is enabled.
panelBuilder.item(31, this.getSettingsButton(Button.GAMEMODE_GUI_VIEW_MODE));
}

panelBuilder.item(14, this.getSettingsButton(Button.LORE_LENGTH));
panelBuilder.item(23, this.getSettingsButton(Button.CHALLENGE_LORE));
Expand Down Expand Up @@ -294,7 +301,7 @@ private PanelItem getSettingsButton(Button button)
glow = this.settings.isAddCompletedGlow();
break;
}
case GAMEMODE_GUI:
case GAMEMODE_GUI_VIEW_MODE:
{
description = new ArrayList<>(2);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.gui-view-mode"));
Expand Down Expand Up @@ -322,6 +329,27 @@ private PanelItem getSettingsButton(Button button)
glow = this.settings.getUserGuiMode().equals(Settings.GuiMode.GAMEMODE_LIST);
break;
}
case GAMEMODE_GUI:
{
description = new ArrayList<>(2);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.gui-mode"));
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
"[value]",
this.settings.isUseCommonGUI() ?
this.user.getTranslation("challenges.gui.descriptions.enabled") :
this.user.getTranslation("challenges.gui.descriptions.disabled")));
name = this.user.getTranslation("challenges.gui.buttons.admin.gui-mode");
icon = new ItemStack(Material.BLACK_STAINED_GLASS_PANE);
clickHandler = (panel, user1, clickType, i) -> {
this.settings.setUseCommonGUI(!this.settings.isUseCommonGUI());
// We cannot use single item changing as this option enabling/disabling will change other
// option visibility.
this.build();
return true;
};
glow = this.settings.isUseCommonGUI();
break;
}
case HISTORY:
{
description = new ArrayList<>(2);
Expand Down Expand Up @@ -446,8 +474,9 @@ private enum Button
LEVEL_LORE,
CHALLENGE_LORE,
FREE_AT_TOP,
GAMEMODE_GUI,
HISTORY,
GAMEMODE_GUI_VIEW_MODE,
GAMEMODE_GUI,
HISTORY,
PURGE_HISTORY,
STORE_MODE,
GLOW_COMPLETED,
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ challenges:
level-lore: 'Level Description'
challenge-lore: 'Challenge Description'
gui-view-mode: 'Display All GameModes'
gui-mode: 'Single Challenges GUI'
history-store: 'Challenges History'
history-lifespan: 'History LifeSpan'
island-store: 'Store per Island'
Expand Down Expand Up @@ -230,6 +231,7 @@ challenges:
history-lifespan: 'Allows to modify how many days history data will be saved.|0 means forever.'
island-store: 'Allows to enable/disable challenges data string per island. This means that challenges will be the same on whole team, if this is enabled.|Will NOT convert data on click. PROGRESS WILL BE LOST.'
default-locked-icon: 'Allows to change default locked level icon.|This option can be overwritten by each level.'
gui-mode: 'Allows to enable/disable single challenges GUI.|&2Requires server restart.'
current-value: '|&6Current value: [value].'
enabled: 'Active'
disabled: 'Disabled'
Expand Down

0 comments on commit 6bf439c

Please sign in to comment.