From 923ce3ad17928f6c4f0c495aa5eded86b7064b8b Mon Sep 17 00:00:00 2001 From: tastybento Date: Sat, 5 Oct 2024 01:09:55 -0700 Subject: [PATCH] Make island owner the setting of limtis --- .../java/world/bentobox/limits/Settings.java | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/main/java/world/bentobox/limits/Settings.java b/src/main/java/world/bentobox/limits/Settings.java index db0f71e..3eb19d3 100644 --- a/src/main/java/world/bentobox/limits/Settings.java +++ b/src/main/java/world/bentobox/limits/Settings.java @@ -8,6 +8,11 @@ import org.bukkit.entity.EntityType; public class Settings { + enum GeneralGroup { + ANIMALS, MOBS + } + + private final Map general = new EnumMap<>(GeneralGroup.class); private final Map limits = new EnumMap<>(EntityType.class); private final Map> groupLimits = new EnumMap<>(EntityType.class); private final List gameModes; @@ -45,15 +50,21 @@ public class Settings { ConfigurationSection el = addon.getConfig().getConfigurationSection("entitylimits"); if (el != null) { for (String key : el.getKeys(false)) { - EntityType type = getType(key); - if (type != null) { - if (DISALLOWED.contains(type)) { - addon.logError("Entity type: " + key + " is not supported - skipping..."); - } else { - limits.put(type, el.getInt(key, 0)); - } + if (key.equalsIgnoreCase("ANIMALS")) { + general.put(GeneralGroup.ANIMALS, el.getInt(key, 0)); + } else if (key.equalsIgnoreCase("MOBS")) { + general.put(GeneralGroup.MOBS, el.getInt(key, 0)); } else { - addon.logError("Unknown entity type: " + key + " - skipping..."); + EntityType type = getType(key); + if (type != null) { + if (DISALLOWED.contains(type)) { + addon.logError("Entity type: " + key + " is not supported - skipping..."); + } else { + limits.put(type, el.getInt(key, 0)); + } + } else { + addon.logError("Unknown entity type: " + key + " - skipping..."); + } } } } @@ -193,4 +204,11 @@ public class Settings { public boolean isAsyncGolums() { return asyncGolums; } + + /** + * @return the general coverage map + */ + public Map getGeneral() { + return general; + } }