From 94cffec16c2a1c5d61cd097c124b4ab6592012f7 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Fri, 24 Mar 2017 15:07:59 +0100 Subject: [PATCH] Add EnumerationUtil to simplify updates for server owners. --- .../factions/engine/EngineFlagExplosion.java | 4 +- .../factions/engine/EngineFlagSpawn.java | 6 +- .../factions/engine/EnginePermBuild.java | 17 +- .../massivecraft/factions/entity/MConf.java | 155 +---------- .../factions/util/EnumerationUtil.java | 241 ++++++++++++++++++ 5 files changed, 268 insertions(+), 155 deletions(-) create mode 100644 src/com/massivecraft/factions/util/EnumerationUtil.java diff --git a/src/com/massivecraft/factions/engine/EngineFlagExplosion.java b/src/com/massivecraft/factions/engine/EngineFlagExplosion.java index 1c684a18..ef264f96 100644 --- a/src/com/massivecraft/factions/engine/EngineFlagExplosion.java +++ b/src/com/massivecraft/factions/engine/EngineFlagExplosion.java @@ -2,7 +2,7 @@ package com.massivecraft.factions.engine; import com.massivecraft.factions.entity.BoardColl; import com.massivecraft.factions.entity.Faction; -import com.massivecraft.factions.entity.MConf; +import com.massivecraft.factions.util.EnumerationUtil; import com.massivecraft.massivecore.Engine; import com.massivecraft.massivecore.ps.PS; import org.bukkit.Location; @@ -61,7 +61,7 @@ public class EngineFlagExplosion extends Engine if ( ! DAMAGE_CAUSE_EXPLOSIONS.contains(event.getCause())) return; // ... an entity that is modified on damage ... - if ( ! MConf.get().entityTypesEditOnDamage.contains(event.getEntityType())) return; + if ( ! EnumerationUtil.isEntityTypeEditOnDamage(event.getEntityType())) return; // ... and the faction has explosions disabled ... if (BoardColl.get().getFactionAt(PS.valueOf(event.getEntity())).isExplosionsAllowed()) return; diff --git a/src/com/massivecraft/factions/engine/EngineFlagSpawn.java b/src/com/massivecraft/factions/engine/EngineFlagSpawn.java index c6eae837..458db80e 100644 --- a/src/com/massivecraft/factions/engine/EngineFlagSpawn.java +++ b/src/com/massivecraft/factions/engine/EngineFlagSpawn.java @@ -2,8 +2,8 @@ package com.massivecraft.factions.engine; import com.massivecraft.factions.entity.BoardColl; import com.massivecraft.factions.entity.Faction; -import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MFlag; +import com.massivecraft.factions.util.EnumerationUtil; import com.massivecraft.massivecore.Engine; import com.massivecraft.massivecore.collections.BackstringSet; import com.massivecraft.massivecore.ps.PS; @@ -71,12 +71,12 @@ public class EngineFlagSpawn extends Engine public static boolean canSpawn(Faction faction, EntityType type) { - if (MConf.get().entityTypesMonsters.contains(type)) + if (EnumerationUtil.isEntityTypeMonster(type)) { // Monster return faction.getFlag(MFlag.getFlagMonsters()); } - else if (MConf.get().entityTypesAnimals.contains(type)) + else if (EnumerationUtil.isEntityTypeAnimal(type)) { // Animal return faction.getFlag(MFlag.getFlagAnimals()); diff --git a/src/com/massivecraft/factions/engine/EnginePermBuild.java b/src/com/massivecraft/factions/engine/EnginePermBuild.java index 96bf1093..701a7cc1 100644 --- a/src/com/massivecraft/factions/engine/EnginePermBuild.java +++ b/src/com/massivecraft/factions/engine/EnginePermBuild.java @@ -10,6 +10,7 @@ import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.integration.spigot.IntegrationSpigot; +import com.massivecraft.factions.util.EnumerationUtil; import com.massivecraft.massivecore.Engine; import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.util.MUtil; @@ -296,7 +297,7 @@ public class EnginePermBuild extends Engine // ... damages an entity which is edited on damage ... Entity edamagee = event.getEntity(); if (edamagee == null) return; - if ( ! MConf.get().entityTypesEditOnDamage.contains(edamagee.getType())) return; + if ( ! EnumerationUtil.isEntityTypeEditOnDamage(edamagee.getType())) return; // ... and the player can't build there ... if (canPlayerBuildAt(player, PS.valueOf(edamagee.getLocation()), true)) return; @@ -334,8 +335,8 @@ public class EnginePermBuild extends Engine public static boolean playerCanUseItemHere(Player player, PS ps, Material material, boolean verboose) { if (MUtil.isntPlayer(player)) return true; - - if ( ! MConf.get().materialsEditTools.contains(material) && ! MConf.get().materialsEditToolsDupeBug.contains(material)) return true; + + if ( ! EnumerationUtil.isMaterialEditTool(material)) return true; String name = player.getName(); if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true; @@ -359,9 +360,9 @@ public class EnginePermBuild extends Engine PS ps = PS.valueOf(block); Material material = block.getType(); - if (MConf.get().materialsEditOnInteract.contains(material) && ! MPerm.getPermBuild().has(me, ps, verboose)) return false; - if (MConf.get().materialsContainer.contains(material) && ! MPerm.getPermContainer().has(me, ps, verboose)) return false; - if (MConf.get().materialsDoor.contains(material) && ! MPerm.getPermDoor().has(me, ps, verboose)) return false; + if (EnumerationUtil.isMaterialEditOnInteract(material) && ! MPerm.getPermBuild().has(me, ps, verboose)) return false; + if (EnumerationUtil.isMaterialContainer(material) && ! MPerm.getPermContainer().has(me, ps, verboose)) return false; + if (EnumerationUtil.isMaterialDoor(material) && ! MPerm.getPermDoor().has(me, ps, verboose)) return false; if (material == Material.STONE_BUTTON && ! MPerm.getPermButton().has(me, ps, verboose)) return false; if (material == Material.LEVER && ! MPerm.getPermLever().has(me, ps, verboose)) return false; return true; @@ -406,10 +407,10 @@ public class EnginePermBuild extends Engine if (me.isOverriding()) return true; // ... check container entity rights ... - if (MConf.get().entityTypesContainer.contains(type) && ! MPerm.getPermContainer().has(me, ps, verboose)) return false; + if (EnumerationUtil.isEntityTypeContainer(type) && ! MPerm.getPermContainer().has(me, ps, verboose)) return false; // ... check build entity rights ... - if (MConf.get().entityTypesEditOnInteract.contains(type) && ! MPerm.getPermBuild().has(me, ps, verboose)) return false; + if (EnumerationUtil.isEntityTypeEditOnInteract(type) && ! MPerm.getPermBuild().has(me, ps, verboose)) return false; // ... otherwise we may use the entity. return true; diff --git a/src/com/massivecraft/factions/entity/MConf.java b/src/com/massivecraft/factions/entity/MConf.java index cd0b1c90..ba08e39f 100644 --- a/src/com/massivecraft/factions/entity/MConf.java +++ b/src/com/massivecraft/factions/entity/MConf.java @@ -531,168 +531,39 @@ public class MConf extends Entity // -------------------------------------------- // // ENUMERATIONS // -------------------------------------------- // - - // These values are fine for most standard bukkit/spigot servers. - // If you however are using Forge with mods that add new container types you might want to add them here. + // In this configuration section you can add support for Forge mods that add new Materials and EntityTypes. // This way they can be protected in Faction territory. + // Use the "UPPER_CASE_NAME" for the Material or EntityType in question. + // If you are running a regular Spigot server you don't have to edit this section. + // In fact all of these sets can be empty on regular Spigot servers without any risk. // Interacting with these materials when they are already placed in the terrain results in an edit. - public BackstringSet materialsEditOnInteract = new BackstringSet<>(Material.class, - "DIODE_BLOCK_OFF", // Minecraft 1.? - "DIODE_BLOCK_ON", // Minecraft 1.? - "NOTE_BLOCK", // Minecraft 1.? - "CAULDRON", // Minecraft 1.? - "SOIL", // Minecraft 1.? - "DAYLIGHT_DETECTOR", // Minecraft 1.5 - "DAYLIGHT_DETECTOR_INVERTED", // Minecraft 1.5 - "REDSTONE_COMPARATOR_OFF", // Minecraft 1.? - "REDSTONE_COMPARATOR_ON" // Minecraft 1.? - ); + public BackstringSet materialsEditOnInteract = new BackstringSet<>(Material.class); // Interacting with the the terrain holding this item in hand results in an edit. // There's no need to add all block materials here. Only special items other than blocks. - public BackstringSet materialsEditTools = new BackstringSet<>(Material.class, - "FIREBALL", // Minecraft 1.? - "FLINT_AND_STEEL", // Minecraft 1.? - "BUCKET", // Minecraft 1.? - "WATER_BUCKET", // Minecraft 1.? - "LAVA_BUCKET", // Minecraft 1.? - "ARMOR_STAND", // Minecraft 1.8 - "END_CRYSTAL" // Minecraft 1.10 - ); - - // The duplication bug found in Spigot 1.8 protocol patch - // https://github.com/MassiveCraft/Factions/issues/693 - public BackstringSet materialsEditToolsDupeBug = new BackstringSet<>(Material.class, - "CHEST", // Minecraft 1.? - "SIGN_POST", // Minecraft 1.? - "TRAPPED_CHEST", // Minecraft 1.? - "SIGN", // Minecraft 1.? - "WOOD_DOOR", // Minecraft 1.? - "IRON_DOOR" // Minecraft 1.? - ); + public BackstringSet materialsEditTools = new BackstringSet<>(Material.class); // Interacting with these materials placed in the terrain results in door toggling. - public BackstringSet materialsDoor = new BackstringSet<>(Material.class, - "WOODEN_DOOR", // Minecraft 1.? - "ACACIA_DOOR", // Minecraft 1.8 - "BIRCH_DOOR", // Minecraft 1.8 - "DARK_OAK_DOOR", // Minecraft 1.8 - "JUNGLE_DOOR", // Minecraft 1.8 - "SPRUCE_DOOR", // Minecraft 1.8 - "TRAP_DOOR", // Minecraft 1.? - "FENCE_GATE", // Minecraft 1.? - "ACACIA_FENCE_GATE", // Minecraft 1.8 - "BIRCH_FENCE_GATE", // Minecraft 1.8 - "DARK_OAK_FENCE_GATE", // Minecraft 1.8 - "JUNGLE_FENCE_GATE", // Minecraft 1.8 - "SPRUCE_FENCE_GATE" // Minecraft 1.8 - ); + public BackstringSet materialsDoor = new BackstringSet<>(Material.class); // Interacting with these materials placed in the terrain results in opening a container. - public BackstringSet materialsContainer = new BackstringSet<>(Material.class, - "DISPENSER", // Minecraft 1.? - "CHEST", // Minecraft 1.? - "FURNACE", // Minecraft 1.? - "BURNING_FURNACE", // Minecraft 1.? - "JUKEBOX", // Minecraft 1.? - "BREWING_STAND", // Minecraft 1.? - "ENCHANTMENT_TABLE", // Minecraft 1.? - "ANVIL", // Minecraft 1.? - "BEACON", // Minecraft 1.? - "TRAPPED_CHEST", // Minecraft 1.? - "HOPPER", // Minecraft 1.? - "DROPPER", // Minecraft 1.? - - // The various shulker boxes, they had to make each one a different material -.- - "BLACK_SHULKER_BOX", // Minecraft 1.11 - "BLUE_SHULKER_BOX", // Minecraft 1.11 - "BROWN_SHULKER_BOX", // Minecraft 1.11 - "CYAN_SHULKER_BOX", // Minecraft 1.11 - "GRAY_SHULKER_BOX", // Minecraft 1.11 - "GREEN_SHULKER_BOX", // Minecraft 1.11 - "LIGHT_BLUE_SHULKER_BOX", // Minecraft 1.11 - "LIME_SHULKER_BOX", // Minecraft 1.11 - "MAGENTA_SHULKER_BOX", // Minecraft 1.11 - "ORANGE_SHULKER_BOX", // Minecraft 1.11 - "PINK_SHULKER_BOX", // Minecraft 1.11 - "PURPLE_SHULKER_BOX", // Minecraft 1.11 - "RED_SHULKER_BOX", // Minecraft 1.11 - "SILVER_SHULKER_BOX", // Minecraft 1.11 - "WHITE_SHULKER_BOX", // Minecraft 1.11 - "YELLOW_SHULKER_BOX" // Minecraft 1.11 - ); + public BackstringSet materialsContainer = new BackstringSet<>(Material.class); // Interacting with these entities results in an edit. - public BackstringSet entityTypesEditOnInteract = new BackstringSet<>(EntityType.class, - "ITEM_FRAME", // Minecraft 1.? - "ARMOR_STAND" // Minecraft 1.8 - ); + public BackstringSet entityTypesEditOnInteract = new BackstringSet<>(EntityType.class); // Damaging these entities results in an edit. - public BackstringSet entityTypesEditOnDamage = new BackstringSet<>(EntityType.class, - "ITEM_FRAME", // Minecraft 1.? - "ARMOR_STAND", // Minecraft 1.8 - "ENDER_CRYSTAL" // Minecraft 1.10 - ); + public BackstringSet entityTypesEditOnDamage = new BackstringSet<>(EntityType.class); // Interacting with these entities results in opening a container. - public BackstringSet entityTypesContainer = new BackstringSet<>(EntityType.class, - "MINECART_CHEST", // Minecraft 1.? - "MINECART_HOPPER" // Minecraft 1.? - ); + public BackstringSet entityTypesContainer = new BackstringSet<>(EntityType.class); // The complete list of entities considered to be monsters. - public BackstringSet entityTypesMonsters = new BackstringSet<>(EntityType.class, - "BLAZE", // Minecraft 1.? - "CAVE_SPIDER", // Minecraft 1.? - "CREEPER", // Minecraft 1.? - "ELDER_GUARDIAN", // minecraft 1.11 - "ENDERMAN", // Minecraft 1.? - "ENDERMITE", // Minecraft 1.8 - "ENDER_DRAGON", // Minecraft 1.? - "EVOKER", // Minecraft 1.11 - "GUARDIAN", // Minecraft 1.8 - "GHAST", // Minecraft 1.? - "GIANT", // Minecraft 1.? - "HUSK", // Minecraft 1.11 - "MAGMA_CUBE", // Minecraft 1.? - "PIG_ZOMBIE", // Minecraft 1.? - "POLAR_BEAR", // Minecraft 1.10 - "SILVERFISH", // Minecraft 1.? - "SHULKER", // Minecraft 1.10 - "SKELETON", // Minecraft 1.? - "SLIME", // Minecraft 1.? - "SPIDER", // Minecraft 1.? - "STRAY", // Minecraft 1.11 - "VINDICATOR", // Minecraft 1.11 - "VEX", // Minecraft 1.11 - "WITCH", // Minecraft 1.? - "WITHER", // Minecraft 1.? - "WITHER_SKELETON", // Minecraft 1.11 - "ZOMBIE", // Minecraft 1.? - "ZOMBIE_VILLAGER" // Minecraft 1.11 - ); + public BackstringSet entityTypesMonsters = new BackstringSet<>(EntityType.class); // List of entities considered to be animals. - public BackstringSet entityTypesAnimals = new BackstringSet<>(EntityType.class, - "BAT", // Minecraft 1.? - "CHICKEN", // Minecraft 1.? - "COW", // Minecraft 1.? - "DONKEY", // Minecraft 1.11 - "HORSE", // Minecraft 1.? - "LLAMA", // Minecraft 1.11 - "MULE", // Minecraft 1.11 - "MUSHROOM_COW", // Minecraft 1.? - "OCELOT", // Minecraft 1.? - "PIG", // Minecraft 1.? - "RABBIT", // Minecraft 1.? - "SHEEP", // Minecraft 1.? - "SKELETON_HORSE", // Minecraft 1.11 - "SQUID", // Minecraft 1.? - "WOLF", // Minecraft 1.? - "ZOMBIE_HORSE" // Minecraft 1.11 - ); + public BackstringSet entityTypesAnimals = new BackstringSet<>(EntityType.class); // -------------------------------------------- // // INTEGRATION: HeroChat diff --git a/src/com/massivecraft/factions/util/EnumerationUtil.java b/src/com/massivecraft/factions/util/EnumerationUtil.java new file mode 100644 index 00000000..8c70bcec --- /dev/null +++ b/src/com/massivecraft/factions/util/EnumerationUtil.java @@ -0,0 +1,241 @@ +package com.massivecraft.factions.util; + +import com.massivecraft.factions.entity.MConf; +import com.massivecraft.massivecore.collections.BackstringSet; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; + +public class EnumerationUtil +{ + // -------------------------------------------- // + // MATERIAL EDIT ON INTERACT + // -------------------------------------------- // + + private static final BackstringSet MATERIALS_EDIT_ON_INTERACT = new BackstringSet<>(Material.class, + "DIODE_BLOCK_OFF", // Minecraft 1.? + "DIODE_BLOCK_ON", // Minecraft 1.? + "NOTE_BLOCK", // Minecraft 1.? + "CAULDRON", // Minecraft 1.? + "SOIL", // Minecraft 1.? + "DAYLIGHT_DETECTOR", // Minecraft 1.5 + "DAYLIGHT_DETECTOR_INVERTED", // Minecraft 1.5 + "REDSTONE_COMPARATOR_OFF", // Minecraft 1.? + "REDSTONE_COMPARATOR_ON" // Minecraft 1.? + ); + + public static boolean isMaterialEditOnInteract(Material material) + { + return MATERIALS_EDIT_ON_INTERACT.contains(material) || MConf.get().materialsEditOnInteract.contains(material); + } + + // -------------------------------------------- // + // MATERIAL EDIT TOOLS + // -------------------------------------------- // + + private static final BackstringSet MATERIALS_EDIT_TOOLS = new BackstringSet<>(Material.class, + "FIREBALL", // Minecraft 1.? + "FLINT_AND_STEEL", // Minecraft 1.? + "BUCKET", // Minecraft 1.? + "WATER_BUCKET", // Minecraft 1.? + "LAVA_BUCKET", // Minecraft 1.? + "ARMOR_STAND", // Minecraft 1.8 + "END_CRYSTAL", // Minecraft 1.10 + + // The duplication bug found in Spigot 1.8 protocol patch + // https://github.com/MassiveCraft/Factions/issues/693 + "CHEST", // Minecraft 1.? + "SIGN_POST", // Minecraft 1.? + "TRAPPED_CHEST", // Minecraft 1.? + "SIGN", // Minecraft 1.? + "WOOD_DOOR", // Minecraft 1.? + "IRON_DOOR" // Minecraft 1.? + ); + + public static boolean isMaterialEditTool(Material material) + { + return MATERIALS_EDIT_TOOLS.contains(material) || MConf.get().materialsEditTools.contains(material); + } + + // -------------------------------------------- // + // MATERIAL DOOR + // -------------------------------------------- // + + // Interacting with these materials placed in the terrain results in door toggling. + private static final BackstringSet MATERIALS_DOOR = new BackstringSet<>(Material.class, + "WOODEN_DOOR", // Minecraft 1.? + "ACACIA_DOOR", // Minecraft 1.8 + "BIRCH_DOOR", // Minecraft 1.8 + "DARK_OAK_DOOR", // Minecraft 1.8 + "JUNGLE_DOOR", // Minecraft 1.8 + "SPRUCE_DOOR", // Minecraft 1.8 + "TRAP_DOOR", // Minecraft 1.? + "FENCE_GATE", // Minecraft 1.? + "ACACIA_FENCE_GATE", // Minecraft 1.8 + "BIRCH_FENCE_GATE", // Minecraft 1.8 + "DARK_OAK_FENCE_GATE", // Minecraft 1.8 + "JUNGLE_FENCE_GATE", // Minecraft 1.8 + "SPRUCE_FENCE_GATE" // Minecraft 1.8 + ); + + public static boolean isMaterialDoor(Material material) + { + return MATERIALS_DOOR.contains(material) || MConf.get().materialsDoor.contains(material); + } + + // -------------------------------------------- // + // MATERIAL CONTAINER + // -------------------------------------------- // + + private static final BackstringSet MATERIALS_CONTAINER = new BackstringSet<>(Material.class, + "DISPENSER", // Minecraft 1.? + "CHEST", // Minecraft 1.? + "FURNACE", // Minecraft 1.? + "BURNING_FURNACE", // Minecraft 1.? + "JUKEBOX", // Minecraft 1.? + "BREWING_STAND", // Minecraft 1.? + "ENCHANTMENT_TABLE", // Minecraft 1.? + "ANVIL", // Minecraft 1.? + "BEACON", // Minecraft 1.? + "TRAPPED_CHEST", // Minecraft 1.? + "HOPPER", // Minecraft 1.? + "DROPPER", // Minecraft 1.? + + // The various shulker boxes, they had to make each one a different material -.- + "BLACK_SHULKER_BOX", // Minecraft 1.11 + "BLUE_SHULKER_BOX", // Minecraft 1.11 + "BROWN_SHULKER_BOX", // Minecraft 1.11 + "CYAN_SHULKER_BOX", // Minecraft 1.11 + "GRAY_SHULKER_BOX", // Minecraft 1.11 + "GREEN_SHULKER_BOX", // Minecraft 1.11 + "LIGHT_BLUE_SHULKER_BOX", // Minecraft 1.11 + "LIME_SHULKER_BOX", // Minecraft 1.11 + "MAGENTA_SHULKER_BOX", // Minecraft 1.11 + "ORANGE_SHULKER_BOX", // Minecraft 1.11 + "PINK_SHULKER_BOX", // Minecraft 1.11 + "PURPLE_SHULKER_BOX", // Minecraft 1.11 + "RED_SHULKER_BOX", // Minecraft 1.11 + "SILVER_SHULKER_BOX", // Minecraft 1.11 + "WHITE_SHULKER_BOX", // Minecraft 1.11 + "YELLOW_SHULKER_BOX" // Minecraft 1.11 + ); + + public static boolean isMaterialContainer(Material material) + { + return MATERIALS_CONTAINER.contains(material) || MConf.get().materialsContainer.contains(material); + } + + // -------------------------------------------- // + // ENTITY TYPE EDIT ON INTERACT + // -------------------------------------------- // + + // Interacting with these entities results in an edit. + private static final BackstringSet ENTITY_TYPES_EDIT_ON_INTERACT = new BackstringSet<>(EntityType.class, + "ITEM_FRAME", // Minecraft 1.? + "ARMOR_STAND" // Minecraft 1.8 + ); + + public static boolean isEntityTypeEditOnInteract(EntityType entityType) + { + return ENTITY_TYPES_EDIT_ON_INTERACT.contains(entityType) || MConf.get().entityTypesEditOnInteract.contains(entityType); + } + + // -------------------------------------------- // + // ENTITY TYPE EDIT ON DAMAGE + // -------------------------------------------- // + + // Damaging these entities results in an edit. + private static final BackstringSet ENTITY_TYPES_EDIT_ON_DAMAGE = new BackstringSet<>(EntityType.class, + "ITEM_FRAME", // Minecraft 1.? + "ARMOR_STAND", // Minecraft 1.8 + "ENDER_CRYSTAL" // Minecraft 1.10 + ); + + public static boolean isEntityTypeEditOnDamage(EntityType entityType) + { + return ENTITY_TYPES_EDIT_ON_DAMAGE.contains(entityType) || MConf.get().entityTypesEditOnDamage.contains(entityType); + } + + // -------------------------------------------- // + // ENTITY TYPE CONTAINER + // -------------------------------------------- // + + private static final BackstringSet ENTITY_TYPE_CONTAINERS = new BackstringSet<>(EntityType.class, + "MINECART_CHEST", // Minecraft 1.? + "MINECART_HOPPER" // Minecraft 1.? + ); + + public static boolean isEntityTypeContainer(EntityType entityType) + { + return ENTITY_TYPE_CONTAINERS.contains(entityType) || MConf.get().entityTypesContainer.contains(entityType); + } + + // -------------------------------------------- // + // ENTITY TYPE MONSTER + // -------------------------------------------- // + + private static final BackstringSet ENTITY_TYPE_MONSTERS = new BackstringSet<>(EntityType.class, + "BLAZE", // Minecraft 1.? + "CAVE_SPIDER", // Minecraft 1.? + "CREEPER", // Minecraft 1.? + "ELDER_GUARDIAN", // minecraft 1.11 + "ENDERMAN", // Minecraft 1.? + "ENDERMITE", // Minecraft 1.8 + "ENDER_DRAGON", // Minecraft 1.? + "EVOKER", // Minecraft 1.11 + "GUARDIAN", // Minecraft 1.8 + "GHAST", // Minecraft 1.? + "GIANT", // Minecraft 1.? + "HUSK", // Minecraft 1.11 + "MAGMA_CUBE", // Minecraft 1.? + "PIG_ZOMBIE", // Minecraft 1.? + "POLAR_BEAR", // Minecraft 1.10 + "SILVERFISH", // Minecraft 1.? + "SHULKER", // Minecraft 1.10 + "SKELETON", // Minecraft 1.? + "SLIME", // Minecraft 1.? + "SPIDER", // Minecraft 1.? + "STRAY", // Minecraft 1.11 + "VINDICATOR", // Minecraft 1.11 + "VEX", // Minecraft 1.11 + "WITCH", // Minecraft 1.? + "WITHER", // Minecraft 1.? + "WITHER_SKELETON", // Minecraft 1.11 + "ZOMBIE", // Minecraft 1.? + "ZOMBIE_VILLAGER" // Minecraft 1.11 + ); + + public static boolean isEntityTypeMonster(EntityType entityType) + { + return ENTITY_TYPE_MONSTERS.contains(entityType) || MConf.get().entityTypesMonsters.contains(entityType); + } + + // -------------------------------------------- // + // ENTITY TYPE ANIMAL + // -------------------------------------------- // + + private static final BackstringSet ENTITY_TYPE_ANIMALS = new BackstringSet<>(EntityType.class, + "BAT", // Minecraft 1.? + "CHICKEN", // Minecraft 1.? + "COW", // Minecraft 1.? + "DONKEY", // Minecraft 1.11 + "HORSE", // Minecraft 1.? + "LLAMA", // Minecraft 1.11 + "MULE", // Minecraft 1.11 + "MUSHROOM_COW", // Minecraft 1.? + "OCELOT", // Minecraft 1.? + "PIG", // Minecraft 1.? + "RABBIT", // Minecraft 1.? + "SHEEP", // Minecraft 1.? + "SKELETON_HORSE", // Minecraft 1.11 + "SQUID", // Minecraft 1.? + "WOLF", // Minecraft 1.? + "ZOMBIE_HORSE" // Minecraft 1.11 + ); + + public static boolean isEntityTypeAnimal(EntityType entityType) + { + return ENTITY_TYPE_ANIMALS.contains(entityType) || MConf.get().entityTypesAnimals.contains(entityType); + } + + +}