Updated to 1.4.0 BentoBox API

This commit is contained in:
tastybento 2019-03-23 15:45:17 -07:00
parent 1563abf1a7
commit 30b4598ef5
3 changed files with 22 additions and 13 deletions

View File

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

View File

@ -185,9 +185,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")
@ -519,11 +520,11 @@ public class Settings implements DataObject, WorldSettings {
}
/**
* @return the visibleSettings
* @return the hidden flags
*/
@Override
public List<String> getVisibleSettings() {
return visibleSettings;
public List<String> 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<String> visibleSettings) {
this.visibleSettings = visibleSettings;
public void setHiddenFlags(List<String> hiddenFlags) {
this.hiddenFlags = hiddenFlags;
}
/**

View File

@ -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<String> visibleSettings = Collections.emptyList();
s.setVisibleSettings(visibleSettings);
assertEquals(visibleSettings, s.getVisibleSettings());
s.setHiddenFlags(visibleSettings);
assertEquals(visibleSettings, s.getHiddenFlags());
}
/**