diff --git a/src/main/java/world/bentobox/challenges/commands/ChallengesUserCommand.java b/src/main/java/world/bentobox/challenges/commands/ChallengesUserCommand.java index 9919879..f30bd2c 100644 --- a/src/main/java/world/bentobox/challenges/commands/ChallengesUserCommand.java +++ b/src/main/java/world/bentobox/challenges/commands/ChallengesUserCommand.java @@ -6,8 +6,9 @@ import java.util.List; import world.bentobox.bentobox.api.addons.GameModeAddon; import world.bentobox.bentobox.api.commands.CompositeCommand; import world.bentobox.bentobox.api.user.User; + import world.bentobox.challenges.ChallengesAddon; -import world.bentobox.challenges.config.Settings; +import world.bentobox.challenges.config.SettingsUtils.GuiMode; import world.bentobox.challenges.panel.GameModesGUI; @@ -59,7 +60,7 @@ public class ChallengesUserCommand extends CompositeCommand user.performCommand(compositeCommand.getTopLabel() + " challenges")); return true; } - else if (this.addon.getChallengesSettings().getUserGuiMode() == Settings.GuiMode.CURRENT_WORLD) + else if (this.addon.getChallengesSettings().getUserGuiMode() == GuiMode.CURRENT_WORLD) { // Find GameMode and run command for (GameModeAddon addon : this.gameModeAddons) @@ -73,7 +74,7 @@ public class ChallengesUserCommand extends CompositeCommand } } } - else if (this.addon.getChallengesSettings().getUserGuiMode() == Settings.GuiMode.GAMEMODE_LIST) + else if (this.addon.getChallengesSettings().getUserGuiMode() == GuiMode.GAMEMODE_LIST) { new GameModesGUI(this.addon, this.getWorld(), diff --git a/src/main/java/world/bentobox/challenges/config/Settings.java b/src/main/java/world/bentobox/challenges/config/Settings.java index 568baf0..4709abd 100644 --- a/src/main/java/world/bentobox/challenges/config/Settings.java +++ b/src/main/java/world/bentobox/challenges/config/Settings.java @@ -12,6 +12,8 @@ import world.bentobox.bentobox.api.configuration.ConfigEntry; import world.bentobox.bentobox.api.configuration.ConfigObject; import world.bentobox.bentobox.api.configuration.StoreAt; +import world.bentobox.challenges.config.SettingsUtils.GuiMode; + @StoreAt(filename="config.yml", path="addons/Challenges") @ConfigComment("Challenges [version] Configuration") @@ -592,25 +594,4 @@ public class Settings implements ConfigObject { this.lifeSpan = lifeSpan; } - - - // --------------------------------------------------------------------- - // Section: Enums - // --------------------------------------------------------------------- - - - /** - * This enum holds all possible values for Gui Opening for users. - */ - public enum GuiMode - { - /** - * Opens user GUI with list of all GameModes. - */ - GAMEMODE_LIST, - /** - * Opens user GUI with challenges in given world. - */ - CURRENT_WORLD - } } diff --git a/src/main/java/world/bentobox/challenges/config/SettingsUtils.java b/src/main/java/world/bentobox/challenges/config/SettingsUtils.java new file mode 100644 index 0000000..f08215a --- /dev/null +++ b/src/main/java/world/bentobox/challenges/config/SettingsUtils.java @@ -0,0 +1,29 @@ +// +// Created by BONNe +// Copyright - 2019 +// + + +package world.bentobox.challenges.config; + + +/** + * This class holds all enums that are used in Settings class. + */ +public class SettingsUtils +{ + /** + * This enum holds all possible values for Gui Opening for users. + */ + public enum GuiMode + { + /** + * Opens user GUI with list of all GameModes. + */ + GAMEMODE_LIST, + /** + * Opens user GUI with challenges in given world. + */ + CURRENT_WORLD + } +} \ No newline at end of file diff --git a/src/main/java/world/bentobox/challenges/panel/admin/EditSettingsGUI.java b/src/main/java/world/bentobox/challenges/panel/admin/EditSettingsGUI.java index 963b250..2c9166c 100644 --- a/src/main/java/world/bentobox/challenges/panel/admin/EditSettingsGUI.java +++ b/src/main/java/world/bentobox/challenges/panel/admin/EditSettingsGUI.java @@ -14,6 +14,7 @@ import world.bentobox.bentobox.api.panels.builders.PanelItemBuilder; import world.bentobox.bentobox.api.user.User; import world.bentobox.challenges.ChallengesAddon; import world.bentobox.challenges.config.Settings; +import world.bentobox.challenges.config.SettingsUtils.GuiMode; import world.bentobox.challenges.panel.CommonGUI; import world.bentobox.challenges.panel.util.NumberGUI; import world.bentobox.challenges.panel.util.SelectBlocksGUI; @@ -327,26 +328,26 @@ public class EditSettingsGUI extends CommonGUI 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.settings.getUserGuiMode().equals(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.STONE_BUTTON); clickHandler = (panel, user1, clickType, i) -> { - if (this.settings.getUserGuiMode().equals(Settings.GuiMode.GAMEMODE_LIST)) + if (this.settings.getUserGuiMode().equals(GuiMode.GAMEMODE_LIST)) { - this.settings.setUserGuiMode(Settings.GuiMode.CURRENT_WORLD); + this.settings.setUserGuiMode(GuiMode.CURRENT_WORLD); } else { - this.settings.setUserGuiMode(Settings.GuiMode.GAMEMODE_LIST); + this.settings.setUserGuiMode(GuiMode.GAMEMODE_LIST); } panel.getInventory().setItem(i, this.getSettingsButton(button).getItem()); return true; }; - glow = this.settings.getUserGuiMode().equals(Settings.GuiMode.GAMEMODE_LIST); + glow = this.settings.getUserGuiMode().equals(GuiMode.GAMEMODE_LIST); break; } case GAMEMODE_GUI: