Updated to BentoBox 1.4.0 API

This commit is contained in:
tastybento 2019-03-23 15:58:37 -07:00
parent f42c15e225
commit 7753565a8c
4 changed files with 27 additions and 20 deletions

View File

@ -6,7 +6,7 @@
<groupId>world.bentobox</groupId> <groupId>world.bentobox</groupId>
<artifactId>caveblock</artifactId> <artifactId>caveblock</artifactId>
<version>0.1.0</version> <version>0.1.1</version>
<name>CaveBlock</name> <name>CaveBlock</name>
<description>CaveBlock is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like SkyBlock or AcidIsland.</description> <description>CaveBlock is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like SkyBlock or AcidIsland.</description>
@ -86,7 +86,7 @@
<dependency> <dependency>
<groupId>world.bentobox</groupId> <groupId>world.bentobox</groupId>
<artifactId>bentobox</artifactId> <artifactId>bentobox</artifactId>
<version>1.2.0</version> <version>1.4.0-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -30,6 +30,7 @@ public class CaveBlock extends GameModeAddon
this.saveDefaultConfig(); this.saveDefaultConfig();
this.loadSettings(); this.loadSettings();
this.saveWorldSettings();
} }
@ -62,10 +63,7 @@ public class CaveBlock extends GameModeAddon
@Override @Override
public void onDisable() public void onDisable()
{ {
if (this.settings != null) // Do nothing
{
new Config<>(this, Settings.class).saveConfigObject(this.settings);
}
} }
@ -206,6 +204,13 @@ public class CaveBlock extends GameModeAddon
return this.settings; return this.settings;
} }
@Override
public void saveWorldSettings() {
if (settings != null) {
new Config<>(this, Settings.class).saveConfigObject(settings);
}
}
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// Section: Variables // Section: Variables
@ -237,4 +242,5 @@ public class CaveBlock extends GameModeAddon
* String for the end world. * String for the end world.
*/ */
private static final String THE_END = "_the_end"; private static final String THE_END = "_the_end";
} }

View File

@ -358,13 +358,13 @@ public class Settings implements DataObject, WorldSettings
/** /**
* This method returns the visibleSettings object. * This method returns the hiddenFlags object.
* @return the visibleSettings object. * @return the hiddenFlags object.
*/ */
@Override @Override
public List<String> getVisibleSettings() public List<String> getHiddenFlags()
{ {
return visibleSettings; return hiddenFlags;
} }
@ -1111,13 +1111,13 @@ public class Settings implements DataObject, WorldSettings
/** /**
* This method sets the visibleSettings object value. * This method sets the hiddenFlags object value.
* @param visibleSettings the visibleSettings object new value. * @param hiddenFlags the hiddenFlags object new value.
* *
*/ */
public void setVisibleSettings(List<String> visibleSettings) public void setHiddenFlags(List<String> hiddenFlags)
{ {
this.visibleSettings = visibleSettings; this.hiddenFlags = hiddenFlags;
} }
@ -1803,9 +1803,10 @@ public class Settings implements DataObject, WorldSettings
@Adapter(FlagSerializer2.class) @Adapter(FlagSerializer2.class)
private Map<Flag, Integer> defaultIslandSettings = new HashMap<>(); private Map<Flag, Integer> defaultIslandSettings = new HashMap<>();
@ConfigComment("These are the settings visible to users. (Not implemented yet)") @ConfigComment("These settings/flags are hidden from users")
@ConfigEntry(path = "world.visible-settings", experimental = true) @ConfigComment("Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings")
private List<String> visibleSettings = new ArrayList<>(); @ConfigEntry(path = "world.hidden-flags")
private List<String> hiddenFlags = new ArrayList<>();
@ConfigComment("Visitor banned commands - Visitors to islands cannot use these commands in this world") @ConfigComment("Visitor banned commands - Visitors to islands cannot use these commands in this world")
@ConfigEntry(path = "world.visitor-banned-commands") @ConfigEntry(path = "world.visitor-banned-commands")

View File

@ -258,9 +258,9 @@ world:
MONSTER_SPAWN: true MONSTER_SPAWN: true
FIRE_SPREAD: true FIRE_SPREAD: true
PVP_OVERWORLD: false PVP_OVERWORLD: false
# These are the settings visible to users. (Not implemented yet) # These settings/flags are hidden from users
# /!\ This feature is experimental and might not work as expected or might not work at all. # Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings
visible-settings: [] hidden-flags: []
# Visitor banned commands - Visitors to islands cannot use these commands in this world # Visitor banned commands - Visitors to islands cannot use these commands in this world
visitor-banned-commands: visitor-banned-commands:
- spawner - spawner