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>
<artifactId>caveblock</artifactId>
<version>0.1.0</version>
<version>0.1.1</version>
<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>
@ -86,7 +86,7 @@
<dependency>
<groupId>world.bentobox</groupId>
<artifactId>bentobox</artifactId>
<version>1.2.0</version>
<version>1.4.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

View File

@ -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";
}

View File

@ -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<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.
* @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<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)
private Map<Flag, Integer> defaultIslandSettings = new HashMap<>();
@ConfigComment("These are the settings visible to users. (Not implemented yet)")
@ConfigEntry(path = "world.visible-settings", experimental = true)
private List<String> 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<String> hiddenFlags = new ArrayList<>();
@ConfigComment("Visitor banned commands - Visitors to islands cannot use these commands in this world")
@ConfigEntry(path = "world.visitor-banned-commands")

View File

@ -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