From 7753565a8cc7a436050299f07e23732232e06746 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sat, 23 Mar 2019 15:58:37 -0700 Subject: [PATCH] Updated to BentoBox 1.4.0 API --- pom.xml | 4 ++-- .../world/bentobox/caveblock/CaveBlock.java | 14 +++++++---- .../world/bentobox/caveblock/Settings.java | 23 ++++++++++--------- src/main/resources/config.yml | 6 ++--- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index c01cbfb..c78dc2a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ world.bentobox caveblock - 0.1.0 + 0.1.1 CaveBlock CaveBlock is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like SkyBlock or AcidIsland. @@ -86,7 +86,7 @@ world.bentobox bentobox - 1.2.0 + 1.4.0-SNAPSHOT provided diff --git a/src/main/java/world/bentobox/caveblock/CaveBlock.java b/src/main/java/world/bentobox/caveblock/CaveBlock.java index c170de6..8535b78 100644 --- a/src/main/java/world/bentobox/caveblock/CaveBlock.java +++ b/src/main/java/world/bentobox/caveblock/CaveBlock.java @@ -30,6 +30,7 @@ public class CaveBlock extends GameModeAddon this.saveDefaultConfig(); this.loadSettings(); + this.saveWorldSettings(); } @@ -62,10 +63,7 @@ public class CaveBlock extends GameModeAddon @Override public void onDisable() { - if (this.settings != null) - { - new Config<>(this, Settings.class).saveConfigObject(this.settings); - } + // Do nothing } @@ -206,6 +204,13 @@ public class CaveBlock extends GameModeAddon return this.settings; } + @Override + public void saveWorldSettings() { + if (settings != null) { + new Config<>(this, Settings.class).saveConfigObject(settings); + } + + } // --------------------------------------------------------------------- // Section: Variables @@ -237,4 +242,5 @@ public class CaveBlock extends GameModeAddon * String for the end world. */ private static final String THE_END = "_the_end"; + } diff --git a/src/main/java/world/bentobox/caveblock/Settings.java b/src/main/java/world/bentobox/caveblock/Settings.java index 9e74479..4908fc4 100644 --- a/src/main/java/world/bentobox/caveblock/Settings.java +++ b/src/main/java/world/bentobox/caveblock/Settings.java @@ -358,13 +358,13 @@ public class Settings implements DataObject, WorldSettings /** - * This method returns the visibleSettings object. - * @return the visibleSettings object. + * This method returns the hiddenFlags object. + * @return the hiddenFlags object. */ @Override - public List getVisibleSettings() + public List getHiddenFlags() { - return visibleSettings; + return hiddenFlags; } @@ -1111,13 +1111,13 @@ public class Settings implements DataObject, WorldSettings /** - * This method sets the visibleSettings object value. - * @param visibleSettings the visibleSettings object new value. + * This method sets the hiddenFlags object value. + * @param hiddenFlags the hiddenFlags object new value. * */ - public void setVisibleSettings(List visibleSettings) + public void setHiddenFlags(List hiddenFlags) { - this.visibleSettings = visibleSettings; + this.hiddenFlags = hiddenFlags; } @@ -1803,9 +1803,10 @@ public class Settings implements DataObject, WorldSettings @Adapter(FlagSerializer2.class) private Map defaultIslandSettings = new HashMap<>(); - @ConfigComment("These are the settings visible to users. (Not implemented yet)") - @ConfigEntry(path = "world.visible-settings", experimental = true) - private List visibleSettings = new ArrayList<>(); + @ConfigComment("These settings/flags are hidden from users") + @ConfigComment("Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings") + @ConfigEntry(path = "world.hidden-flags") + private List hiddenFlags = new ArrayList<>(); @ConfigComment("Visitor banned commands - Visitors to islands cannot use these commands in this world") @ConfigEntry(path = "world.visitor-banned-commands") diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 29691c8..20f48e7 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -258,9 +258,9 @@ world: MONSTER_SPAWN: true FIRE_SPREAD: true PVP_OVERWORLD: false - # These are the settings visible to users. (Not implemented yet) - # /!\ This feature is experimental and might not work as expected or might not work at all. - visible-settings: [] + # These settings/flags are hidden from users + # Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings + hidden-flags: [] # Visitor banned commands - Visitors to islands cannot use these commands in this world visitor-banned-commands: - spawner