Add EnumerationUtil to simplify updates for server owners.

This commit is contained in:
Olof Larsson 2017-03-24 15:07:59 +01:00
parent f32af6e02f
commit 94cffec16c
5 changed files with 268 additions and 155 deletions

View File

@ -2,7 +2,7 @@ package com.massivecraft.factions.engine;
import com.massivecraft.factions.entity.BoardColl; import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.Faction; 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.Engine;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
import org.bukkit.Location; import org.bukkit.Location;
@ -61,7 +61,7 @@ public class EngineFlagExplosion extends Engine
if ( ! DAMAGE_CAUSE_EXPLOSIONS.contains(event.getCause())) return; if ( ! DAMAGE_CAUSE_EXPLOSIONS.contains(event.getCause())) return;
// ... an entity that is modified on damage ... // ... 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 ... // ... and the faction has explosions disabled ...
if (BoardColl.get().getFactionAt(PS.valueOf(event.getEntity())).isExplosionsAllowed()) return; if (BoardColl.get().getFactionAt(PS.valueOf(event.getEntity())).isExplosionsAllowed()) return;

View File

@ -2,8 +2,8 @@ package com.massivecraft.factions.engine;
import com.massivecraft.factions.entity.BoardColl; import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MFlag; import com.massivecraft.factions.entity.MFlag;
import com.massivecraft.factions.util.EnumerationUtil;
import com.massivecraft.massivecore.Engine; import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.collections.BackstringSet; import com.massivecraft.massivecore.collections.BackstringSet;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
@ -71,12 +71,12 @@ public class EngineFlagSpawn extends Engine
public static boolean canSpawn(Faction faction, EntityType type) public static boolean canSpawn(Faction faction, EntityType type)
{ {
if (MConf.get().entityTypesMonsters.contains(type)) if (EnumerationUtil.isEntityTypeMonster(type))
{ {
// Monster // Monster
return faction.getFlag(MFlag.getFlagMonsters()); return faction.getFlag(MFlag.getFlagMonsters());
} }
else if (MConf.get().entityTypesAnimals.contains(type)) else if (EnumerationUtil.isEntityTypeAnimal(type))
{ {
// Animal // Animal
return faction.getFlag(MFlag.getFlagAnimals()); return faction.getFlag(MFlag.getFlagAnimals());

View File

@ -10,6 +10,7 @@ import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.integration.spigot.IntegrationSpigot; import com.massivecraft.factions.integration.spigot.IntegrationSpigot;
import com.massivecraft.factions.util.EnumerationUtil;
import com.massivecraft.massivecore.Engine; import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
@ -296,7 +297,7 @@ public class EnginePermBuild extends Engine
// ... damages an entity which is edited on damage ... // ... damages an entity which is edited on damage ...
Entity edamagee = event.getEntity(); Entity edamagee = event.getEntity();
if (edamagee == null) return; 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 ... // ... and the player can't build there ...
if (canPlayerBuildAt(player, PS.valueOf(edamagee.getLocation()), true)) return; 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) public static boolean playerCanUseItemHere(Player player, PS ps, Material material, boolean verboose)
{ {
if (MUtil.isntPlayer(player)) return true; 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(); String name = player.getName();
if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true; if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true;
@ -359,9 +360,9 @@ public class EnginePermBuild extends Engine
PS ps = PS.valueOf(block); PS ps = PS.valueOf(block);
Material material = block.getType(); Material material = block.getType();
if (MConf.get().materialsEditOnInteract.contains(material) && ! MPerm.getPermBuild().has(me, ps, verboose)) return false; if (EnumerationUtil.isMaterialEditOnInteract(material) && ! MPerm.getPermBuild().has(me, ps, verboose)) return false;
if (MConf.get().materialsContainer.contains(material) && ! MPerm.getPermContainer().has(me, ps, verboose)) return false; if (EnumerationUtil.isMaterialContainer(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.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.STONE_BUTTON && ! MPerm.getPermButton().has(me, ps, verboose)) return false;
if (material == Material.LEVER && ! MPerm.getPermLever().has(me, ps, verboose)) return false; if (material == Material.LEVER && ! MPerm.getPermLever().has(me, ps, verboose)) return false;
return true; return true;
@ -406,10 +407,10 @@ public class EnginePermBuild extends Engine
if (me.isOverriding()) return true; if (me.isOverriding()) return true;
// ... check container entity rights ... // ... 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 ... // ... 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. // ... otherwise we may use the entity.
return true; return true;

View File

@ -531,168 +531,39 @@ public class MConf extends Entity<MConf>
// -------------------------------------------- // // -------------------------------------------- //
// ENUMERATIONS // ENUMERATIONS
// -------------------------------------------- // // -------------------------------------------- //
// In this configuration section you can add support for Forge mods that add new Materials and EntityTypes.
// 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.
// This way they can be protected in Faction territory. // 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. // Interacting with these materials when they are already placed in the terrain results in an edit.
public BackstringSet<Material> materialsEditOnInteract = new BackstringSet<>(Material.class, public BackstringSet<Material> 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.?
);
// Interacting with the the terrain holding this item in hand results in an edit. // 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. // There's no need to add all block materials here. Only special items other than blocks.
public BackstringSet<Material> materialsEditTools = new BackstringSet<>(Material.class, public BackstringSet<Material> 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<Material> 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.?
);
// Interacting with these materials placed in the terrain results in door toggling. // Interacting with these materials placed in the terrain results in door toggling.
public BackstringSet<Material> materialsDoor = new BackstringSet<>(Material.class, public BackstringSet<Material> 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
);
// Interacting with these materials placed in the terrain results in opening a container. // Interacting with these materials placed in the terrain results in opening a container.
public BackstringSet<Material> materialsContainer = new BackstringSet<>(Material.class, public BackstringSet<Material> 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
);
// Interacting with these entities results in an edit. // Interacting with these entities results in an edit.
public BackstringSet<EntityType> entityTypesEditOnInteract = new BackstringSet<>(EntityType.class, public BackstringSet<EntityType> entityTypesEditOnInteract = new BackstringSet<>(EntityType.class);
"ITEM_FRAME", // Minecraft 1.?
"ARMOR_STAND" // Minecraft 1.8
);
// Damaging these entities results in an edit. // Damaging these entities results in an edit.
public BackstringSet<EntityType> entityTypesEditOnDamage = new BackstringSet<>(EntityType.class, public BackstringSet<EntityType> entityTypesEditOnDamage = new BackstringSet<>(EntityType.class);
"ITEM_FRAME", // Minecraft 1.?
"ARMOR_STAND", // Minecraft 1.8
"ENDER_CRYSTAL" // Minecraft 1.10
);
// Interacting with these entities results in opening a container. // Interacting with these entities results in opening a container.
public BackstringSet<EntityType> entityTypesContainer = new BackstringSet<>(EntityType.class, public BackstringSet<EntityType> entityTypesContainer = new BackstringSet<>(EntityType.class);
"MINECART_CHEST", // Minecraft 1.?
"MINECART_HOPPER" // Minecraft 1.?
);
// The complete list of entities considered to be monsters. // The complete list of entities considered to be monsters.
public BackstringSet<EntityType> entityTypesMonsters = new BackstringSet<>(EntityType.class, public BackstringSet<EntityType> 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
);
// List of entities considered to be animals. // List of entities considered to be animals.
public BackstringSet<EntityType> entityTypesAnimals = new BackstringSet<>(EntityType.class, public BackstringSet<EntityType> 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
);
// -------------------------------------------- // // -------------------------------------------- //
// INTEGRATION: HeroChat // INTEGRATION: HeroChat

View File

@ -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<Material> 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<Material> 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<Material> 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<Material> 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<EntityType> 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<EntityType> 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<EntityType> 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<EntityType> 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<EntityType> 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);
}
}