From cc31d334bf150fadd15b0d68075141bae10d2b26 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Tue, 16 Dec 2014 02:07:09 +0100 Subject: [PATCH] Use implicit string based lazily evaluating sets instead of explicit enum sets. Fixes MassiveCraft/Factions#730. Fixes MassiveCraft/Factions#733. --- .../massivecraft/factions/entity/MConf.java | 137 +++++++++--------- 1 file changed, 69 insertions(+), 68 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/entity/MConf.java b/src/main/java/com/massivecraft/factions/entity/MConf.java index 0462c5da..6a583ee0 100644 --- a/src/main/java/com/massivecraft/factions/entity/MConf.java +++ b/src/main/java/com/massivecraft/factions/entity/MConf.java @@ -17,6 +17,7 @@ import com.massivecraft.factions.Rel; import com.massivecraft.factions.WorldExceptionSet; import com.massivecraft.factions.engine.EngineChat; import com.massivecraft.factions.event.EventFactionsChunkChangeType; +import com.massivecraft.massivecore.collections.BackstringEnumSet; import com.massivecraft.massivecore.store.Entity; import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.TimeUnit; @@ -466,88 +467,88 @@ public class MConf extends Entity // If you however are using Forge with mods that add new container types you might want to add them here. // This way they can be protected in Faction territory. - public Set materialsEditOnInteract = MUtil.set( - Material.DIODE_BLOCK_OFF, - Material.DIODE_BLOCK_ON, - Material.NOTE_BLOCK, - Material.CAULDRON, - Material.SOIL + public BackstringEnumSet materialsEditOnInteract = new BackstringEnumSet(Material.class, + "DIODE_BLOCK_OFF", // Minecraft 1.? + "DIODE_BLOCK_ON", // Minecraft 1.? + "NOTE_BLOCK", // Minecraft 1.? + "CAULDRON", // Minecraft 1.? + "SOIL" // Minecraft 1.? ); - public Set materialsEditTools = MUtil.set( - Material.FIREBALL, - Material.FLINT_AND_STEEL, - Material.BUCKET, - Material.WATER_BUCKET, - Material.LAVA_BUCKET + public BackstringEnumSet materialsEditTools = new BackstringEnumSet(Material.class, + "FIREBALL", // Minecraft 1.? + "FLINT_AND_STEEL", // Minecraft 1.? + "BUCKET", // Minecraft 1.? + "WATER_BUCKET", // Minecraft 1.? + "LAVA_BUCKET" // Minecraft 1.? ); // The duplication bug found in Spigot 1.8 protocol patch // https://github.com/MassiveCraft/Factions/issues/693 - public Set materialsEditToolsDupeBug = MUtil.set( - Material.CHEST, - Material.SIGN_POST, - Material.TRAPPED_CHEST, - Material.SIGN, - Material.WOOD_DOOR, - Material.IRON_DOOR + public BackstringEnumSet materialsEditToolsDupeBug = new BackstringEnumSet(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 Set materialsDoor = MUtil.set( - Material.WOODEN_DOOR, - Material.ACACIA_DOOR, - Material.BIRCH_DOOR, - Material.DARK_OAK_DOOR, - Material.JUNGLE_DOOR, - Material.SPRUCE_DOOR, - Material.TRAP_DOOR, - Material.FENCE_GATE, - Material.ACACIA_FENCE_GATE, - Material.BIRCH_FENCE_GATE, - Material.DARK_OAK_FENCE_GATE, - Material.JUNGLE_FENCE_GATE, - Material.SPRUCE_FENCE_GATE + public BackstringEnumSet materialsDoor = new BackstringEnumSet(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 Set materialsContainer = MUtil.set( - Material.DISPENSER, - Material.CHEST, - Material.FURNACE, - Material.BURNING_FURNACE, - Material.JUKEBOX, - Material.BREWING_STAND, - Material.ENCHANTMENT_TABLE, - Material.ANVIL, - Material.BEACON, - Material.TRAPPED_CHEST, - Material.HOPPER, - Material.DROPPER + public BackstringEnumSet materialsContainer = new BackstringEnumSet(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.? ); - public Set entityTypesContainer = MUtil.set( - EntityType.MINECART_CHEST, - EntityType.MINECART_HOPPER, - EntityType.ARMOR_STAND + public BackstringEnumSet entityTypesContainer = new BackstringEnumSet(EntityType.class, + "MINECART_CHEST", // Minecraft 1.? + "MINECART_HOPPER", // Minecraft 1.? + "ARMOR_STAND" // Minecraft 1.? ); - public Set entityTypesMonsters = MUtil.set( - EntityType.BLAZE, - EntityType.CAVE_SPIDER, - EntityType.CREEPER, - EntityType.ENDERMAN, - EntityType.ENDER_DRAGON, - EntityType.GUARDIAN, - EntityType.GHAST, - EntityType.GIANT, - EntityType.MAGMA_CUBE, - EntityType.PIG_ZOMBIE, - EntityType.SILVERFISH, - EntityType.SKELETON, - EntityType.SLIME, - EntityType.SPIDER, - EntityType.WITCH, - EntityType.WITHER, - EntityType.ZOMBIE + public BackstringEnumSet entityTypesMonsters = new BackstringEnumSet(EntityType.class, + "BLAZE", // Minecraft 1.? + "CAVE_SPIDER", // Minecraft 1.? + "CREEPER", // Minecraft 1.? + "ENDERMAN", // Minecraft 1.? + "ENDER_DRAGON", // Minecraft 1.? + "GUARDIAN", // Minecraft 1.8 + "GHAST", // Minecraft 1.? + "GIANT", // Minecraft 1.? + "MAGMA_CUBE", // Minecraft 1.? + "PIG_ZOMBIE", // Minecraft 1.? + "SILVERFISH", // Minecraft 1.? + "SKELETON", // Minecraft 1.? + "SLIME", // Minecraft 1.? + "SPIDER", // Minecraft 1.? + "WITCH", // Minecraft 1.? + "WITHER", // Minecraft 1.? + "ZOMBIE" // Minecraft 1.? ); // -------------------------------------------- //