diff --git a/api/src/main/java/de/erethon/dungeonsxl/api/dungeon/GameRule.java b/api/src/main/java/de/erethon/dungeonsxl/api/dungeon/GameRule.java index 1ac42b79..f269fb9e 100644 --- a/api/src/main/java/de/erethon/dungeonsxl/api/dungeon/GameRule.java +++ b/api/src/main/java/de/erethon/dungeonsxl/api/dungeon/GameRule.java @@ -16,7 +16,6 @@ package de.erethon.dungeonsxl.api.dungeon; import de.erethon.caliburn.item.ExItem; import de.erethon.caliburn.mob.ExMob; -import de.erethon.caliburn.mob.VanillaMob; import de.erethon.commons.chat.MessageUtil; import de.erethon.commons.misc.EnumUtil; import de.erethon.commons.misc.NumberUtil; @@ -27,7 +26,6 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -117,22 +115,13 @@ public class GameRule { public static final GameRule>> INTERACTION_BLACKLIST = new MapGameRule<>("interactionBlacklist", null, ConfigReader.TOOL_BLOCK_MAP_READER, HashMap::new); /** - * A list of all entity types that shall be protected from damage. If this is left out AND if breakBlocks is false, armor stands, paintings and item frames - * will be protected by default. If this is left out and if breakBlocks is true, nothing will be protected by default. + * A list of all entity types that shall be protected from damage. */ - public static final GameRule> DAMAGE_PROTECTED_ENTITIES = new CollectionGameRule<>("damageProtectedEntities", new HashSet<>(Arrays.asList( - VanillaMob.ARMOR_STAND, - VanillaMob.ITEM_FRAME, - VanillaMob.PAINTING - )), ConfigReader.EX_MOB_SET_READER, HashSet::new); + public static final GameRule> DAMAGE_PROTECTED_ENTITIES = new CollectionGameRule<>("damageProtectedEntities", null, ConfigReader.EX_MOB_SET_READER, HashSet::new); /** - * If this is left out AND if breakBlocks is false, armor stands and item frames will be protected by default. If this is left out and if breakBlocks is - * true, nothing will be protected by default. + * A list of all entity types that shall be protected from interaction. */ - public static final GameRule> INTERACTION_PROTECTED_ENTITIES = new CollectionGameRule<>("interactionProtectedEntities", new HashSet<>(Arrays.asList( - VanillaMob.ARMOR_STAND, - VanillaMob.ITEM_FRAME - )), ConfigReader.EX_MOB_SET_READER, HashSet::new); + public static final GameRule> INTERACTION_PROTECTED_ENTITIES = new CollectionGameRule<>("interactionProtectedEntities", null, ConfigReader.EX_MOB_SET_READER, HashSet::new); /** * If blocks may be placed. */ diff --git a/api/src/main/java/de/erethon/dungeonsxl/api/dungeon/GameRuleContainer.java b/api/src/main/java/de/erethon/dungeonsxl/api/dungeon/GameRuleContainer.java index 3707ea18..9d04e9e0 100644 --- a/api/src/main/java/de/erethon/dungeonsxl/api/dungeon/GameRuleContainer.java +++ b/api/src/main/java/de/erethon/dungeonsxl/api/dungeon/GameRuleContainer.java @@ -15,7 +15,6 @@ package de.erethon.dungeonsxl.api.dungeon; import java.util.HashMap; -import java.util.HashSet; import java.util.Map; /** @@ -102,18 +101,6 @@ public class GameRuleContainer { */ public void merge(GameRuleContainer subsidiary) { subsidiary.rules.entrySet().forEach(e -> e.getKey().merge(this, subsidiary, this)); - - // If we are using the last subsidiary rules (the default rules) and if blocks may be broken... - if (subsidiary != DEFAULT_VALUES || !getState(GameRule.BREAK_BLOCKS)) { - return; - } - // ...then it makes no sense to set *ProtectedEntities to default where several block-like entities (like paintings) are protected. - if (getState(GameRule.DAMAGE_PROTECTED_ENTITIES) == DEFAULT_VALUES.getState(GameRule.DAMAGE_PROTECTED_ENTITIES)) { - setState(GameRule.DAMAGE_PROTECTED_ENTITIES, new HashSet<>()); - } - if (getState(GameRule.INTERACTION_PROTECTED_ENTITIES) == DEFAULT_VALUES.getState(GameRule.INTERACTION_PROTECTED_ENTITIES)) { - setState(GameRule.INTERACTION_PROTECTED_ENTITIES, new HashSet<>()); - } } @Override diff --git a/core/src/main/java/de/erethon/dungeonsxl/config/MainConfig.java b/core/src/main/java/de/erethon/dungeonsxl/config/MainConfig.java index 4af8bc6e..63c9d824 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/config/MainConfig.java +++ b/core/src/main/java/de/erethon/dungeonsxl/config/MainConfig.java @@ -480,9 +480,11 @@ public class MainConfig extends DREConfig { config.set("editPermissions", editPermissions); } - /* Default DDungeon Config */ + /* Default Dungeon Config */ if (!config.contains("default")) { - config.createSection("default"); + ConfigurationSection section = config.createSection("default"); + section.set("damageProtectedEntities", Arrays.asList("ARMOR_STAND", "ITEM_FRAME", "PAINTING")); + section.set("interactionProtectedEntities", Arrays.asList("ARMOR_STAND", "ITEM_FRAME")); } save();