mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-12-29 20:37:49 +01:00
Allow to edit Challenge and Level description properties from Admin GUI
This commit is contained in:
parent
250aea2f27
commit
7fd4e4cd0f
@ -7,6 +7,7 @@ import org.bukkit.World;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.wesjd.anvilgui.AnvilGUI;
|
||||||
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
|
||||||
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder;
|
||||||
import world.bentobox.bentobox.api.user.User;
|
import world.bentobox.bentobox.api.user.User;
|
||||||
@ -179,12 +180,60 @@ public class EditSettingsGUI extends CommonGUI
|
|||||||
glow(this.addon.getChallengesSettings().isFreeChallengesFirst()).
|
glow(this.addon.getChallengesSettings().isFreeChallengesFirst()).
|
||||||
build());
|
build());
|
||||||
|
|
||||||
|
// Challenge Lore Message
|
||||||
|
description = new ArrayList<>(2);
|
||||||
|
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.challenge-lore"));
|
||||||
|
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
|
||||||
|
"[value]", this.addon.getChallengesSettings().getChallengeLoreMessage()));
|
||||||
|
panelBuilder.item(24, new PanelItemBuilder().
|
||||||
|
name(this.user.getTranslation("challenges.gui.buttons.admin.challenge-lore")).
|
||||||
|
description(GuiUtils.stringSplit(description, lineLength)).
|
||||||
|
icon(Material.PAPER).
|
||||||
|
clickHandler((panel, user1, clickType, i) -> {
|
||||||
|
new AnvilGUI(this.addon.getPlugin(),
|
||||||
|
this.user.getPlayer(),
|
||||||
|
this.addon.getChallengesSettings().getChallengeLoreMessage(),
|
||||||
|
(player, reply) -> {
|
||||||
|
this.addon.getChallengesSettings().setChallengeLoreMessage(reply);
|
||||||
|
this.build();
|
||||||
|
return reply;
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}).
|
||||||
|
glow(false).
|
||||||
|
build());
|
||||||
|
|
||||||
|
// Level Lore Message
|
||||||
|
description = new ArrayList<>(2);
|
||||||
|
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.level-lore"));
|
||||||
|
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
|
||||||
|
"[value]", this.addon.getChallengesSettings().getLevelLoreMessage()));
|
||||||
|
panelBuilder.item(33, new PanelItemBuilder().
|
||||||
|
name(this.user.getTranslation("challenges.gui.buttons.admin.level-lore")).
|
||||||
|
description(GuiUtils.stringSplit(description, lineLength)).
|
||||||
|
icon(Material.PAPER).
|
||||||
|
clickHandler((panel, user1, clickType, i) -> {
|
||||||
|
new AnvilGUI(this.addon.getPlugin(),
|
||||||
|
this.user.getPlayer(),
|
||||||
|
this.addon.getChallengesSettings().getLevelLoreMessage(),
|
||||||
|
(player, reply) -> {
|
||||||
|
this.addon.getChallengesSettings().setLevelLoreMessage(reply);
|
||||||
|
this.build();
|
||||||
|
return reply;
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}).
|
||||||
|
glow(false).
|
||||||
|
build());
|
||||||
|
|
||||||
// Lore line length
|
// Lore line length
|
||||||
description = new ArrayList<>(2);
|
description = new ArrayList<>(2);
|
||||||
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.line-length"));
|
description.add(this.user.getTranslation("challenges.gui.descriptions.admin.line-length"));
|
||||||
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
|
description.add(this.user.getTranslation("challenges.gui.descriptions.current-value",
|
||||||
"[value]", Integer.toString(this.addon.getChallengesSettings().getLoreLineLength())));
|
"[value]", Integer.toString(this.addon.getChallengesSettings().getLoreLineLength())));
|
||||||
panelBuilder.item(24, new PanelItemBuilder().
|
panelBuilder.item(25, new PanelItemBuilder().
|
||||||
name(this.user.getTranslation("challenges.gui.buttons.admin.line-length")).
|
name(this.user.getTranslation("challenges.gui.buttons.admin.line-length")).
|
||||||
description(GuiUtils.stringSplit(description, lineLength)).
|
description(GuiUtils.stringSplit(description, lineLength)).
|
||||||
icon(Material.ANVIL).
|
icon(Material.ANVIL).
|
||||||
|
@ -133,6 +133,8 @@ challenges:
|
|||||||
clear: 'Clear'
|
clear: 'Clear'
|
||||||
remove-empty: 'Remove empty'
|
remove-empty: 'Remove empty'
|
||||||
number: '[number]'
|
number: '[number]'
|
||||||
|
level-lore: 'Level Description'
|
||||||
|
challenge-lore: 'Challenge Description'
|
||||||
next: 'Next'
|
next: 'Next'
|
||||||
previous: 'Previous'
|
previous: 'Previous'
|
||||||
return: 'Return'
|
return: 'Return'
|
||||||
@ -212,6 +214,8 @@ challenges:
|
|||||||
selected: 'Selected'
|
selected: 'Selected'
|
||||||
remove-selected: 'Remove selected elements.|You can select elements with right mouse button.'
|
remove-selected: 'Remove selected elements.|You can select elements with right mouse button.'
|
||||||
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.'
|
||||||
|
challenge-lore: 'Allows to modify which elements of challenge description should be visible.'
|
||||||
current-value: '|&6Current value: [value].'
|
current-value: '|&6Current value: [value].'
|
||||||
enabled: 'Active'
|
enabled: 'Active'
|
||||||
disabled: 'Disabled'
|
disabled: 'Disabled'
|
||||||
@ -301,4 +305,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: 4
|
version: 5
|
Loading…
Reference in New Issue
Block a user