Add Single GUI enabling button in Settings GUI.

This commit is contained in:
BONNe 2019-03-05 10:55:44 +02:00
parent c737c874da
commit 6bf439cef6
2 changed files with 37 additions and 6 deletions

View File

@ -78,9 +78,16 @@ public class EditSettingsGUI extends CommonGUI
panelBuilder.item(20, this.getSettingsButton(Button.GLOW_COMPLETED)); panelBuilder.item(20, this.getSettingsButton(Button.GLOW_COMPLETED));
panelBuilder.item(29, this.getSettingsButton(Button.REMOVE_COMPLETED)); panelBuilder.item(29, this.getSettingsButton(Button.REMOVE_COMPLETED));
panelBuilder.item(12, this.getSettingsButton(Button.LOCKED_LEVEL_ICON)); panelBuilder.item(21, this.getSettingsButton(Button.LOCKED_LEVEL_ICON));
panelBuilder.item(21, this.getSettingsButton(Button.FREE_AT_TOP)); panelBuilder.item(30, this.getSettingsButton(Button.FREE_AT_TOP));
panelBuilder.item(30, this.getSettingsButton(Button.GAMEMODE_GUI));
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(14, this.getSettingsButton(Button.LORE_LENGTH));
panelBuilder.item(23, this.getSettingsButton(Button.CHALLENGE_LORE)); panelBuilder.item(23, this.getSettingsButton(Button.CHALLENGE_LORE));
@ -294,7 +301,7 @@ public class EditSettingsGUI extends CommonGUI
glow = this.settings.isAddCompletedGlow(); glow = this.settings.isAddCompletedGlow();
break; break;
} }
case GAMEMODE_GUI: case GAMEMODE_GUI_VIEW_MODE:
{ {
description = new ArrayList<>(2); description = new ArrayList<>(2);
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.gui-view-mode")); description.add(this.user.getTranslation("challenges.gui.descriptions.admin.gui-view-mode"));
@ -322,6 +329,27 @@ public class EditSettingsGUI extends CommonGUI
glow = this.settings.getUserGuiMode().equals(Settings.GuiMode.GAMEMODE_LIST); glow = this.settings.getUserGuiMode().equals(Settings.GuiMode.GAMEMODE_LIST);
break; 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: case HISTORY:
{ {
description = new ArrayList<>(2); description = new ArrayList<>(2);
@ -446,8 +474,9 @@ public class EditSettingsGUI extends CommonGUI
LEVEL_LORE, LEVEL_LORE,
CHALLENGE_LORE, CHALLENGE_LORE,
FREE_AT_TOP, FREE_AT_TOP,
GAMEMODE_GUI, GAMEMODE_GUI_VIEW_MODE,
HISTORY, GAMEMODE_GUI,
HISTORY,
PURGE_HISTORY, PURGE_HISTORY,
STORE_MODE, STORE_MODE,
GLOW_COMPLETED, GLOW_COMPLETED,

View File

@ -138,6 +138,7 @@ challenges:
level-lore: 'Level Description' level-lore: 'Level Description'
challenge-lore: 'Challenge Description' challenge-lore: 'Challenge Description'
gui-view-mode: 'Display All GameModes' gui-view-mode: 'Display All GameModes'
gui-mode: 'Single Challenges GUI'
history-store: 'Challenges History' history-store: 'Challenges History'
history-lifespan: 'History LifeSpan' history-lifespan: 'History LifeSpan'
island-store: 'Store per Island' island-store: 'Store per Island'
@ -230,6 +231,7 @@ challenges:
history-lifespan: 'Allows to modify how many days history data will be saved.|0 means forever.' 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.' 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.' 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].' current-value: '|&6Current value: [value].'
enabled: 'Active' enabled: 'Active'
disabled: 'Disabled' disabled: 'Disabled'