From 5868815e9dc798586fec09f93e3c90e91b1073cd Mon Sep 17 00:00:00 2001 From: BONNe Date: Tue, 4 Oct 2022 15:07:28 +0300 Subject: [PATCH] Update to BentoBox 1.21 API --- pom.xml | 4 +- .../world/bentobox/acidisland/AISettings.java | 62 +++++++++++++------ 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/pom.xml b/pom.xml index 27bf1c0..4ef69b8 100644 --- a/pom.xml +++ b/pom.xml @@ -58,8 +58,8 @@ 2.0.9 - 1.18-R0.1-SNAPSHOT - 1.20.0 + 1.19-R0.1-SNAPSHOT + 1.21.0 ${build.version}-SNAPSHOT diff --git a/src/main/java/world/bentobox/acidisland/AISettings.java b/src/main/java/world/bentobox/acidisland/AISettings.java index 872a099..60a27f8 100644 --- a/src/main/java/world/bentobox/acidisland/AISettings.java +++ b/src/main/java/world/bentobox/acidisland/AISettings.java @@ -1,11 +1,6 @@ package world.bentobox.acidisland; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import org.bukkit.Difficulty; import org.bukkit.GameMode; @@ -21,10 +16,8 @@ import world.bentobox.bentobox.api.configuration.ConfigEntry; import world.bentobox.bentobox.api.configuration.StoreAt; import world.bentobox.bentobox.api.configuration.WorldSettings; import world.bentobox.bentobox.api.flags.Flag; -import world.bentobox.bentobox.database.objects.adapters.Adapter; -import world.bentobox.bentobox.database.objects.adapters.FlagSerializer; -import world.bentobox.bentobox.database.objects.adapters.FlagSerializer2; -import world.bentobox.bentobox.database.objects.adapters.PotionEffectListAdapter; +import world.bentobox.bentobox.database.objects.adapters.*; + /** * Settings for AcidIsland @@ -331,13 +324,12 @@ public class AISettings implements WorldSettings { @ConfigComment("The value is the minimum island rank required allowed to do the action") @ConfigComment("Ranks are: Visitor = 0, Member = 900, Owner = 1000") @ConfigEntry(path = "world.default-island-flags") - @Adapter(FlagSerializer.class) - private Map defaultIslandFlags = new HashMap<>(); + private Map defaultIslandFlagNames = new HashMap<>(); @ConfigComment("These are the default settings for new islands") @ConfigEntry(path = "world.default-island-settings") - @Adapter(FlagSerializer2.class) - private Map defaultIslandSettings = new HashMap<>(); + @Adapter(FlagBooleanSerializer.class) + private Map defaultIslandSettingNames = new HashMap<>(); @ConfigComment("These settings/flags are hidden from users") @ConfigComment("Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings") @@ -686,20 +678,50 @@ public class AISettings implements WorldSettings { public GameMode getDefaultGameMode() { return defaultGameMode; } + + + /** + * @return the defaultIslandFlags + * @since 1.21.0 + */ + @Override + public Map getDefaultIslandFlagNames() + { + return defaultIslandFlagNames; + } + + + /** + * @return the defaultIslandSettings + * @since 1.21.0 + */ + @Override + public Map getDefaultIslandSettingNames() + { + return defaultIslandSettingNames; + } + + /** * @return the defaultIslandProtection + * @deprecated since 1.21 */ @Override public Map getDefaultIslandFlags() { - return defaultIslandFlags; + return Collections.emptyMap(); } + + /** * @return the defaultIslandSettings + * @deprecated since 1.21 */ @Override public Map getDefaultIslandSettings() { - return defaultIslandSettings; + return Collections.emptyMap(); } + + /** * @return the difficulty */ @@ -1203,14 +1225,14 @@ public class AISettings implements WorldSettings { } /** */ - public void setDefaultIslandFlags(Map defaultIslandFlags) { - this.defaultIslandFlags = defaultIslandFlags; + public void setDefaultIslandFlagNames(Map defaultIslandFlags) { + this.defaultIslandFlagNames = defaultIslandFlags; } /** * @param defaultIslandSettings the defaultIslandSettings to set */ - public void setDefaultIslandSettings(Map defaultIslandSettings) { - this.defaultIslandSettings = defaultIslandSettings; + public void setDefaultIslandSettingNames(Map defaultIslandSettings) { + this.defaultIslandSettingNames = defaultIslandSettings; } /** * @param difficulty the difficulty to set