mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2025-02-11 09:51:44 +01:00
Add new Buttons to settings GUI
This commit is contained in:
parent
0bb3171c5c
commit
f77c141772
@ -73,13 +73,26 @@ public class EditSettingsGUI extends CommonGUI
|
|||||||
GuiUtils.fillBorder(panelBuilder);
|
GuiUtils.fillBorder(panelBuilder);
|
||||||
|
|
||||||
panelBuilder.item(19, this.getSettingsButton(Button.RESET_CHALLENGES));
|
panelBuilder.item(19, this.getSettingsButton(Button.RESET_CHALLENGES));
|
||||||
|
panelBuilder.item(28, this.getSettingsButton(Button.REMOVE_COMPLETED));
|
||||||
|
|
||||||
panelBuilder.item(20, this.getSettingsButton(Button.BROADCAST));
|
panelBuilder.item(20, this.getSettingsButton(Button.BROADCAST));
|
||||||
panelBuilder.item(21, this.getSettingsButton(Button.REMOVE_COMPLETED));
|
panelBuilder.item(29, this.getSettingsButton(Button.GLOW_COMPLETED));
|
||||||
panelBuilder.item(22, this.getSettingsButton(Button.GLOW_COMPLETED));
|
|
||||||
panelBuilder.item(23, this.getSettingsButton(Button.FREE_AT_TOP));
|
panelBuilder.item(22, this.getSettingsButton(Button.FREE_AT_TOP));
|
||||||
panelBuilder.item(24, this.getSettingsButton(Button.CHALLENGE_LORE));
|
panelBuilder.item(31, this.getSettingsButton(Button.GAMEMODE_GUI));
|
||||||
panelBuilder.item(33, this.getSettingsButton(Button.LEVEL_LORE));
|
|
||||||
panelBuilder.item(25, this.getSettingsButton(Button.LORE_LENGTH));
|
panelBuilder.item(14, this.getSettingsButton(Button.LORE_LENGTH));
|
||||||
|
panelBuilder.item(23, this.getSettingsButton(Button.CHALLENGE_LORE));
|
||||||
|
panelBuilder.item(32, this.getSettingsButton(Button.LEVEL_LORE));
|
||||||
|
|
||||||
|
panelBuilder.item(24, this.getSettingsButton(Button.HISTORY));
|
||||||
|
|
||||||
|
if (this.settings.isStoreHistory())
|
||||||
|
{
|
||||||
|
panelBuilder.item(33, this.getSettingsButton(Button.PURGE_HISTORY));
|
||||||
|
}
|
||||||
|
|
||||||
|
panelBuilder.item(25, this.getSettingsButton(Button.STORE_MODE));
|
||||||
|
|
||||||
// Return Button
|
// Return Button
|
||||||
panelBuilder.item(44, this.returnButton);
|
panelBuilder.item(44, this.returnButton);
|
||||||
@ -265,7 +278,7 @@ public class EditSettingsGUI extends CommonGUI
|
|||||||
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.glow"));
|
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.glow"));
|
||||||
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
|
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
|
||||||
"[value]",
|
"[value]",
|
||||||
this.addon.getChallengesSettings().isAddCompletedGlow() ?
|
this.settings.isAddCompletedGlow() ?
|
||||||
this.user.getTranslation("challenges.gui.descriptions.enabled") :
|
this.user.getTranslation("challenges.gui.descriptions.enabled") :
|
||||||
this.user.getTranslation("challenges.gui.descriptions.disabled")));
|
this.user.getTranslation("challenges.gui.descriptions.disabled")));
|
||||||
|
|
||||||
@ -280,6 +293,102 @@ public class EditSettingsGUI extends CommonGUI
|
|||||||
glow = this.settings.isAddCompletedGlow();
|
glow = this.settings.isAddCompletedGlow();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case GAMEMODE_GUI:
|
||||||
|
{
|
||||||
|
description = new ArrayList<>(2);
|
||||||
|
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.gui-view-mode"));
|
||||||
|
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
|
||||||
|
"[value]",
|
||||||
|
this.settings.getUserGuiMode().equals(Settings.GuiMode.GAMEMODE_LIST) ?
|
||||||
|
this.user.getTranslation("challenges.gui.descriptions.enabled") :
|
||||||
|
this.user.getTranslation("challenges.gui.descriptions.disabled")));
|
||||||
|
name = this.user.getTranslation("challenges.gui.buttons.admin.gui-view-mode");
|
||||||
|
icon = new ItemStack(Material.GLOWSTONE);
|
||||||
|
clickHandler = (panel, user1, clickType, i) -> {
|
||||||
|
|
||||||
|
if (this.settings.getUserGuiMode().equals(Settings.GuiMode.GAMEMODE_LIST))
|
||||||
|
{
|
||||||
|
this.settings.setUserGuiMode(Settings.GuiMode.CURRENT_WORLD);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.settings.setUserGuiMode(Settings.GuiMode.GAMEMODE_LIST);
|
||||||
|
}
|
||||||
|
|
||||||
|
panel.getInventory().setItem(i, this.getSettingsButton(button).getItem());
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
glow = this.settings.getUserGuiMode().equals(Settings.GuiMode.GAMEMODE_LIST);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case HISTORY:
|
||||||
|
{
|
||||||
|
description = new ArrayList<>(2);
|
||||||
|
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.history-store"));
|
||||||
|
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
|
||||||
|
"[value]",
|
||||||
|
this.settings.isStoreHistory() ?
|
||||||
|
this.user.getTranslation("challenges.gui.descriptions.enabled") :
|
||||||
|
this.user.getTranslation("challenges.gui.descriptions.disabled")));
|
||||||
|
name = this.user.getTranslation("challenges.gui.buttons.admin.history-store");
|
||||||
|
icon = new ItemStack(Material.GLOWSTONE);
|
||||||
|
clickHandler = (panel, user1, clickType, i) -> {
|
||||||
|
this.settings.setStoreHistory(!this.settings.isStoreHistory());
|
||||||
|
|
||||||
|
// Need to rebuild all as new buttons will show up.
|
||||||
|
this.build();
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
glow = this.settings.isStoreHistory();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PURGE_HISTORY:
|
||||||
|
{
|
||||||
|
description = new ArrayList<>(2);
|
||||||
|
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.history-lifespan"));
|
||||||
|
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
|
||||||
|
"[value]", Integer.toString(this.settings.getLifeSpan())));
|
||||||
|
name = this.user.getTranslation("challenges.gui.buttons.admin.history-lifespan");
|
||||||
|
icon = new ItemStack(Material.ANVIL);
|
||||||
|
clickHandler = (panel, user1, clickType, i) -> {
|
||||||
|
new NumberGUI(this.user,
|
||||||
|
this.settings.getLifeSpan(),
|
||||||
|
0,
|
||||||
|
this.settings.getLoreLineLength(),
|
||||||
|
(status, value) -> {
|
||||||
|
if (status)
|
||||||
|
{
|
||||||
|
this.settings.setLifeSpan(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
panel.getInventory().setItem(i, this.getSettingsButton(button).getItem());
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
glow = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case STORE_MODE:
|
||||||
|
{
|
||||||
|
description = new ArrayList<>(2);
|
||||||
|
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.island-store"));
|
||||||
|
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
|
||||||
|
"[value]",
|
||||||
|
this.settings.isStoreAsIslandData() ?
|
||||||
|
this.user.getTranslation("challenges.gui.descriptions.enabled") :
|
||||||
|
this.user.getTranslation("challenges.gui.descriptions.disabled")));
|
||||||
|
name = this.user.getTranslation("challenges.gui.buttons.admin.island-store");
|
||||||
|
icon = new ItemStack(Material.GLOWSTONE);
|
||||||
|
clickHandler = (panel, user1, clickType, i) -> {
|
||||||
|
this.settings.setStoreAsIslandData(!this.settings.isStoreAsIslandData());
|
||||||
|
// TODO: Data Migration must be added here.
|
||||||
|
panel.getInventory().setItem(i, this.getSettingsButton(button).getItem());
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
glow = this.settings.isStoreAsIslandData();
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return new PanelItemBuilder().build();
|
return new PanelItemBuilder().build();
|
||||||
}
|
}
|
||||||
@ -304,7 +413,11 @@ public class EditSettingsGUI extends CommonGUI
|
|||||||
LORE_LENGTH,
|
LORE_LENGTH,
|
||||||
LEVEL_LORE,
|
LEVEL_LORE,
|
||||||
CHALLENGE_LORE,
|
CHALLENGE_LORE,
|
||||||
FREE_AT_TOP,
|
FREE_AT_TOP,
|
||||||
|
GAMEMODE_GUI,
|
||||||
|
HISTORY,
|
||||||
|
PURGE_HISTORY,
|
||||||
|
STORE_MODE,
|
||||||
GLOW_COMPLETED
|
GLOW_COMPLETED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,6 +136,10 @@ challenges:
|
|||||||
number: '[number]'
|
number: '[number]'
|
||||||
level-lore: 'Level Description'
|
level-lore: 'Level Description'
|
||||||
challenge-lore: 'Challenge Description'
|
challenge-lore: 'Challenge Description'
|
||||||
|
gui-view-mode: 'Display All GameModes'
|
||||||
|
history-store: 'Challenges History'
|
||||||
|
history-lifespan: 'History LifeSpan'
|
||||||
|
island-store: 'Store per Island'
|
||||||
next: 'Next'
|
next: 'Next'
|
||||||
previous: 'Previous'
|
previous: 'Previous'
|
||||||
return: 'Return'
|
return: 'Return'
|
||||||
@ -218,6 +222,10 @@ challenges:
|
|||||||
show-eggs: 'Switch entity view between Egg mode or Head mode.'
|
show-eggs: 'Switch entity view between Egg mode or Head mode.'
|
||||||
level-lore: 'Allows to modify which elements of level description should be visible.'
|
level-lore: 'Allows to modify which elements of level description should be visible.'
|
||||||
challenge-lore: 'Allows to modify which elements of challenge description should be visible.'
|
challenge-lore: 'Allows to modify which elements of challenge description should be visible.'
|
||||||
|
gui-view-mode: 'Allows to set if /challenges GUI should show GameModes or challenges in players world.'
|
||||||
|
history-store: 'Allows to enable/disable challenges history storage.'
|
||||||
|
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 convert data on click.'
|
||||||
current-value: '|&6Current value: [value].'
|
current-value: '|&6Current value: [value].'
|
||||||
enabled: 'Active'
|
enabled: 'Active'
|
||||||
disabled: 'Disabled'
|
disabled: 'Disabled'
|
||||||
@ -307,4 +315,4 @@ challenges:
|
|||||||
import-no-file: '&cCould not find challenges.yml file to import!'
|
import-no-file: '&cCould not find challenges.yml file to import!'
|
||||||
no-load: '&cError: Could not load challenges.yml. [message]'
|
no-load: '&cError: Could not load challenges.yml. [message]'
|
||||||
load-error: '&cError: Cannot load [value].'
|
load-error: '&cError: Cannot load [value].'
|
||||||
version: 6
|
version: 7
|
Loading…
Reference in New Issue
Block a user