diff --git a/src/main/java/world/bentobox/bskyblock/BSkyBlock.java b/src/main/java/world/bentobox/bskyblock/BSkyBlock.java index 3563f54..d28b428 100644 --- a/src/main/java/world/bentobox/bskyblock/BSkyBlock.java +++ b/src/main/java/world/bentobox/bskyblock/BSkyBlock.java @@ -44,7 +44,7 @@ public class BSkyBlock extends GameModeAddon { setState(State.DISABLED); return; } - new Config<>(this, Settings.class).saveConfigObject(settings); + this.saveWorldSettings(); } @@ -122,4 +122,12 @@ public class BSkyBlock extends GameModeAddon { public @NonNull ChunkGenerator getDefaultWorldGenerator(String worldName, String id) { return chunkGenerator; } + + @Override + public void saveWorldSettings() { + if (settings != null) { + new Config<>(this, Settings.class).saveConfigObject(settings); + } + + } } diff --git a/src/main/java/world/bentobox/bskyblock/Settings.java b/src/main/java/world/bentobox/bskyblock/Settings.java index b9ebe4d..f58c3f5 100644 --- a/src/main/java/world/bentobox/bskyblock/Settings.java +++ b/src/main/java/world/bentobox/bskyblock/Settings.java @@ -185,9 +185,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") @@ -519,11 +520,11 @@ public class Settings implements DataObject, WorldSettings { } /** - * @return the visibleSettings + * @return the hidden flags */ @Override - public List getVisibleSettings() { - return visibleSettings; + public List getHiddenFlags() { + return hiddenFlags; } /** @@ -899,10 +900,10 @@ public class Settings implements DataObject, WorldSettings { } /** - * @param visibleSettings the visibleSettings to set + * @param set the hidden flags */ - public void setVisibleSettings(List visibleSettings) { - this.visibleSettings = visibleSettings; + public void setHiddenFlags(List hiddenFlags) { + this.hiddenFlags = hiddenFlags; } /** diff --git a/src/test/java/world/bentobox/bskyblock/SettingsTest.java b/src/test/java/world/bentobox/bskyblock/SettingsTest.java index 1501296..8900e08 100644 --- a/src/test/java/world/bentobox/bskyblock/SettingsTest.java +++ b/src/test/java/world/bentobox/bskyblock/SettingsTest.java @@ -254,13 +254,13 @@ public class SettingsTest { } /** - * Test method for {@link world.bentobox.bskyblock.Settings#setVisibleSettings(java.util.List)}. + * Test method for {@link world.bentobox.bskyblock.Settings#setHiddenFlags(java.util.List)}. */ @Test public void testSetVisibleSettings() { List visibleSettings = Collections.emptyList(); - s.setVisibleSettings(visibleSettings); - assertEquals(visibleSettings, s.getVisibleSettings()); + s.setHiddenFlags(visibleSettings); + assertEquals(visibleSettings, s.getHiddenFlags()); } /**