alphabetise PlayerEvents stuff and add Turtle Eggs

This commit is contained in:
dordsor21 2019-01-17 16:28:42 +00:00
parent ea422b5561
commit db2e245b13

View File

@ -103,45 +103,46 @@ import java.util.regex.Pattern;
switch (entity.getType()) { switch (entity.getType()) {
case PLAYER: case PLAYER:
return false; return false;
case LLAMA_SPIT: case ARROW:
case SMALL_FIREBALL: case DRAGON_FIREBALL:
case FIREBALL:
case DROPPED_ITEM: case DROPPED_ITEM:
case EGG: case EGG:
case THROWN_EXP_BOTTLE:
case SPLASH_POTION:
case LINGERING_POTION:
case SNOWBALL:
case ENDER_PEARL: case ENDER_PEARL:
case ARROW: case FIREBALL:
case TIPPED_ARROW: case LINGERING_POTION:
case SPECTRAL_ARROW: case LLAMA_SPIT:
case SHULKER_BULLET: case SHULKER_BULLET:
case DRAGON_FIREBALL: case SMALL_FIREBALL:
case SNOWBALL:
case SPECTRAL_ARROW:
case SPLASH_POTION:
case THROWN_EXP_BOTTLE:
case TIPPED_ARROW:
// projectile // projectile
case PRIMED_TNT:
case FALLING_BLOCK: case FALLING_BLOCK:
case PRIMED_TNT:
// Block entities // Block entities
case ENDER_CRYSTAL:
case COMPLEX_PART:
case FISHING_HOOK:
case ENDER_SIGNAL:
case EXPERIENCE_ORB:
case LEASH_HITCH:
case FIREWORK:
case WEATHER:
case AREA_EFFECT_CLOUD: case AREA_EFFECT_CLOUD:
case LIGHTNING: case COMPLEX_PART:
case WITHER_SKULL: case ENDER_CRYSTAL:
case ENDER_SIGNAL:
case EVOKER_FANGS: case EVOKER_FANGS:
case EXPERIENCE_ORB:
case FIREWORK:
case FISHING_HOOK:
case LEASH_HITCH:
case LIGHTNING:
case UNKNOWN: case UNKNOWN:
case WEATHER:
case WITHER_SKULL:
// non moving / unmovable // non moving / unmovable
return EntityUtil.checkEntity(plot, Flags.ENTITY_CAP); return EntityUtil.checkEntity(plot, Flags.ENTITY_CAP);
case ARMOR_STAND:
case ITEM_FRAME: case ITEM_FRAME:
case PAINTING: case PAINTING:
case ARMOR_STAND:
return EntityUtil.checkEntity(plot, Flags.ENTITY_CAP, Flags.MISC_CAP); return EntityUtil.checkEntity(plot, Flags.ENTITY_CAP, Flags.MISC_CAP);
// misc // misc
case BOAT:
case MINECART: case MINECART:
case MINECART_CHEST: case MINECART_CHEST:
case MINECART_COMMAND: case MINECART_COMMAND:
@ -149,67 +150,66 @@ import java.util.regex.Pattern;
case MINECART_HOPPER: case MINECART_HOPPER:
case MINECART_MOB_SPAWNER: case MINECART_MOB_SPAWNER:
case MINECART_TNT: case MINECART_TNT:
case BOAT:
return EntityUtil.checkEntity(plot, Flags.ENTITY_CAP, Flags.VEHICLE_CAP); return EntityUtil.checkEntity(plot, Flags.ENTITY_CAP, Flags.VEHICLE_CAP);
case POLAR_BEAR:
case RABBIT:
case SHEEP:
case MUSHROOM_COW:
case OCELOT:
case PIG:
case SQUID:
case VILLAGER:
case IRON_GOLEM:
case WOLF:
case CHICKEN:
case COW:
case SNOWMAN:
case BAT: case BAT:
case HORSE: case CHICKEN:
case COD:
case COW:
case DOLPHIN:
case DONKEY: case DONKEY:
case HORSE:
case IRON_GOLEM:
case LLAMA: case LLAMA:
case MULE: case MULE:
case ZOMBIE_HORSE: case MUSHROOM_COW:
case SKELETON_HORSE: case OCELOT:
case PARROT: case PARROT:
case TURTLE: case PIG:
case COD: case POLAR_BEAR:
case SALMON:
case DOLPHIN:
case PUFFERFISH: case PUFFERFISH:
case RABBIT:
case SALMON:
case SHEEP:
case SKELETON_HORSE:
case SNOWMAN:
case SQUID:
case TROPICAL_FISH: case TROPICAL_FISH:
case TURTLE:
case VILLAGER:
case WOLF:
case ZOMBIE_HORSE:
// animal // animal
return EntityUtil return EntityUtil
.checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.ANIMAL_CAP); .checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.ANIMAL_CAP);
case BLAZE: case BLAZE:
case CAVE_SPIDER: case CAVE_SPIDER:
case CREEPER: case CREEPER:
case DROWNED:
case ELDER_GUARDIAN:
case ENDERMAN: case ENDERMAN:
case ENDERMITE: case ENDERMITE:
case ENDER_DRAGON: case ENDER_DRAGON:
case EVOKER:
case GHAST: case GHAST:
case GIANT: case GIANT:
case GUARDIAN: case GUARDIAN:
case HUSK:
case ILLUSIONER:
case MAGMA_CUBE: case MAGMA_CUBE:
case PIG_ZOMBIE: case PIG_ZOMBIE:
case SHULKER:
case SILVERFISH: case SILVERFISH:
case SKELETON: case SKELETON:
case SLIME: case SLIME:
case SPIDER: case SPIDER:
case STRAY:
case VEX:
case VINDICATOR:
case WITCH: case WITCH:
case WITHER: case WITHER:
case ZOMBIE:
case SHULKER:
case HUSK:
case STRAY:
case ELDER_GUARDIAN:
case WITHER_SKELETON: case WITHER_SKELETON:
case VINDICATOR: case ZOMBIE:
case EVOKER:
case VEX:
case ZOMBIE_VILLAGER: case ZOMBIE_VILLAGER:
case DROWNED:
case ILLUSIONER:
// monster // monster
return EntityUtil return EntityUtil
.checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.HOSTILE_CAP); .checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.HOSTILE_CAP);
@ -353,10 +353,13 @@ import java.util.regex.Pattern;
} }
return; return;
} }
case DRAGON_EGG:
case ANVIL: case ANVIL:
case DRAGON_EGG:
case GRAVEL:
case SAND: case SAND:
case GRAVEL: { case TURTLE_EGG:
case TURTLE_HELMET:
case TURTLE_SPAWN_EGG: {
Block block = event.getBlock(); Block block = event.getBlock();
Location loc = BukkitUtil.getLocation(block.getLocation()); Location loc = BukkitUtil.getLocation(block.getLocation());
PlotArea area = loc.getPlotArea(); PlotArea area = loc.getPlotArea();
@ -690,15 +693,15 @@ import java.util.regex.Pattern;
} }
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) { if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
switch (vehicle.getType()) { switch (vehicle.getType()) {
case BOAT:
case ENDER_CRYSTAL:
case MINECART: case MINECART:
case MINECART_CHEST: case MINECART_CHEST:
case MINECART_COMMAND: case MINECART_COMMAND:
case MINECART_FURNACE: case MINECART_FURNACE:
case MINECART_HOPPER: case MINECART_HOPPER:
case MINECART_MOB_SPAWNER: case MINECART_MOB_SPAWNER:
case ENDER_CRYSTAL: case MINECART_TNT: {
case MINECART_TNT:
case BOAT: {
List<MetadataValue> meta = vehicle.getMetadata("plot"); List<MetadataValue> meta = vehicle.getMetadata("plot");
Plot toPlot = BukkitUtil.getLocation(to).getPlot(); Plot toPlot = BukkitUtil.getLocation(to).getPlot();
if (!meta.isEmpty()) { if (!meta.isEmpty()) {
@ -1726,44 +1729,41 @@ import java.util.regex.Pattern;
location = BukkitUtil.getLocation(block.getLocation()); location = BukkitUtil.getLocation(block.getLocation());
Material blockType = block.getType(); Material blockType = block.getType();
switch (blockType) { switch (blockType) {
case ANVIL:
case ACACIA_DOOR: case ACACIA_DOOR:
case BIRCH_DOOR: case BIRCH_DOOR:
case DARK_OAK_DOOR: case DARK_OAK_DOOR:
case IRON_DOOR: case IRON_DOOR:
case JUNGLE_DOOR: case JUNGLE_DOOR:
case SPRUCE_DOOR:
case OAK_DOOR: case OAK_DOOR:
case SPRUCE_DOOR:
case ACACIA_TRAPDOOR: case ACACIA_TRAPDOOR:
case BIRCH_TRAPDOOR: case BIRCH_TRAPDOOR:
case DARK_OAK_TRAPDOOR: case DARK_OAK_TRAPDOOR:
case IRON_TRAPDOOR:
case JUNGLE_TRAPDOOR: case JUNGLE_TRAPDOOR:
case OAK_TRAPDOOR: case OAK_TRAPDOOR:
case SPRUCE_TRAPDOOR: case SPRUCE_TRAPDOOR:
case IRON_TRAPDOOR:
case TRAPPED_CHEST:
case ENDER_CHEST:
case CHEST: case CHEST:
case ENDER_CHEST:
case TRAPPED_CHEST:
case ACACIA_FENCE_GATE: case ACACIA_FENCE_GATE:
case BIRCH_FENCE_GATE: case BIRCH_FENCE_GATE:
case DARK_OAK_FENCE_GATE: case DARK_OAK_FENCE_GATE:
case OAK_FENCE_GATE: case OAK_FENCE_GATE:
case JUNGLE_FENCE_GATE: case JUNGLE_FENCE_GATE:
case SPRUCE_FENCE_GATE: case SPRUCE_FENCE_GATE:
case LEVER:
case REDSTONE_TORCH: case ACACIA_BUTTON:
case REDSTONE_WALL_TORCH:
case COMMAND_BLOCK:
case COMPARATOR:
case REDSTONE_ORE:
case BIRCH_BUTTON: case BIRCH_BUTTON:
case DARK_OAK_BUTTON: case DARK_OAK_BUTTON:
case JUNGLE_BUTTON: case JUNGLE_BUTTON:
case ACACIA_BUTTON:
case OAK_BUTTON: case OAK_BUTTON:
case SPRUCE_BUTTON: case SPRUCE_BUTTON:
case STONE_BUTTON: case STONE_BUTTON:
case BEACON:
case BLACK_BED: case BLACK_BED:
case BLUE_BED: case BLUE_BED:
case BROWN_BED: case BROWN_BED:
@ -1780,10 +1780,7 @@ import java.util.regex.Pattern;
case RED_BED: case RED_BED:
case WHITE_BED: case WHITE_BED:
case YELLOW_BED: case YELLOW_BED:
case SIGN:
case WALL_SIGN:
case ENCHANTING_TABLE:
case BREWING_STAND:
case BLACK_BANNER: case BLACK_BANNER:
case BLACK_WALL_BANNER: case BLACK_WALL_BANNER:
case BLUE_BANNER: case BLUE_BANNER:
@ -1816,33 +1813,53 @@ import java.util.regex.Pattern;
case WHITE_WALL_BANNER: case WHITE_WALL_BANNER:
case YELLOW_BANNER: case YELLOW_BANNER:
case YELLOW_WALL_BANNER: case YELLOW_WALL_BANNER:
case FURNACE:
case CAKE:
case DISPENSER:
case DROPPER:
case HOPPER:
case NOTE_BLOCK:
case JUKEBOX:
case CRAFTING_TABLE:
case LIGHT_GRAY_SHULKER_BOX:
case BLACK_SHULKER_BOX: case BLACK_SHULKER_BOX:
case BLUE_SHULKER_BOX: case BLUE_SHULKER_BOX:
case RED_SHULKER_BOX:
case PINK_SHULKER_BOX:
case ORANGE_SHULKER_BOX:
case WHITE_SHULKER_BOX:
case YELLOW_SHULKER_BOX:
case BROWN_SHULKER_BOX: case BROWN_SHULKER_BOX:
case CYAN_SHULKER_BOX: case CYAN_SHULKER_BOX:
case GREEN_SHULKER_BOX:
case PURPLE_SHULKER_BOX:
case GRAY_SHULKER_BOX: case GRAY_SHULKER_BOX:
case LIME_SHULKER_BOX: case GREEN_SHULKER_BOX:
case LIGHT_BLUE_SHULKER_BOX: case LIGHT_BLUE_SHULKER_BOX:
case LIGHT_GRAY_SHULKER_BOX:
case LIME_SHULKER_BOX:
case MAGENTA_SHULKER_BOX: case MAGENTA_SHULKER_BOX:
case ORANGE_SHULKER_BOX:
case PINK_SHULKER_BOX:
case PURPLE_SHULKER_BOX:
case RED_SHULKER_BOX:
case WHITE_SHULKER_BOX:
case YELLOW_SHULKER_BOX:
case CHAIN_COMMAND_BLOCK: case CHAIN_COMMAND_BLOCK:
case REPEATING_COMMAND_BLOCK: case REPEATING_COMMAND_BLOCK:
case SIGN:
case WALL_SIGN:
case REDSTONE_TORCH:
case REDSTONE_WALL_TORCH:
case TURTLE_EGG:
case TURTLE_HELMET:
case TURTLE_SPAWN_EGG:
case ANVIL:
case BEACON:
case BREWING_STAND:
case CAKE:
case COMMAND_BLOCK:
case COMPARATOR:
case CRAFTING_TABLE:
case DISPENSER:
case DROPPER:
case ENCHANTING_TABLE:
case FURNACE:
case HOPPER:
case JUKEBOX:
case LEVER:
case NOTE_BLOCK:
case REDSTONE_ORE:
eventType = PlayerBlockEventType.INTERACT_BLOCK; eventType = PlayerBlockEventType.INTERACT_BLOCK;
break; break;
case DRAGON_EGG: case DRAGON_EGG:
@ -1888,60 +1905,60 @@ import java.util.regex.Pattern;
.getLocation(block.getRelative(event.getBlockFace()).getLocation()); .getLocation(block.getRelative(event.getBlockFace()).getLocation());
eventType = PlayerBlockEventType.PLACE_MISC; eventType = PlayerBlockEventType.PLACE_MISC;
break; break;
case WRITTEN_BOOK: case BOOK:
case WRITABLE_BOOK:
case ENCHANTED_BOOK: case ENCHANTED_BOOK:
case KNOWLEDGE_BOOK: case KNOWLEDGE_BOOK:
case BOOK: case WRITABLE_BOOK:
case WRITTEN_BOOK:
eventType = PlayerBlockEventType.READ; eventType = PlayerBlockEventType.READ;
break; break;
case APPLE: case APPLE:
case BAKED_POTATO: case BAKED_POTATO:
case MUSHROOM_STEW: case BEEF:
case BREAD: case BREAD:
case CARROT: case CARROT:
case GOLDEN_CARROT: case CHICKEN:
case COOKIE: case COD:
case PORKCHOP: case COOKED_BEEF:
case POISONOUS_POTATO: case COOKED_CHICKEN:
case MUTTON: case COOKED_COD:
case COOKED_MUTTON:
case COOKED_PORKCHOP: case COOKED_PORKCHOP:
case COOKED_RABBIT:
case COOKED_SALMON:
case COOKIE:
case GOLDEN_CARROT:
case MUSHROOM_STEW:
case MUTTON:
case POISONOUS_POTATO:
case PORKCHOP:
case POTATO: case POTATO:
case POTION: case POTION:
case PUFFERFISH:
case PUMPKIN_PIE: case PUMPKIN_PIE:
case RABBIT: case RABBIT:
case RABBIT_FOOT: case RABBIT_FOOT:
case RABBIT_STEW: case RABBIT_STEW:
case BEEF:
case COOKED_BEEF:
case TROPICAL_FISH:
case PUFFERFISH:
case CHICKEN:
case COOKED_CHICKEN:
case COOKED_MUTTON:
case COOKED_RABBIT:
case COOKED_SALMON:
case SALMON: case SALMON:
case COD: case TROPICAL_FISH:
case COOKED_COD:
eventType = PlayerBlockEventType.EAT; eventType = PlayerBlockEventType.EAT;
break; break;
case MINECART: case ACACIA_BOAT:
case BIRCH_BOAT:
case CHEST_MINECART: case CHEST_MINECART:
case COMMAND_BLOCK_MINECART:
case DARK_OAK_BOAT:
case FURNACE_MINECART: case FURNACE_MINECART:
case HOPPER_MINECART: case HOPPER_MINECART:
case TNT_MINECART:
case COMMAND_BLOCK_MINECART:
case BIRCH_BOAT:
case ACACIA_BOAT:
case DARK_OAK_BOAT:
case JUNGLE_BOAT: case JUNGLE_BOAT:
case MINECART:
case OAK_BOAT: case OAK_BOAT:
case SPRUCE_BOAT: case SPRUCE_BOAT:
case TNT_MINECART:
eventType = PlayerBlockEventType.PLACE_VEHICLE; eventType = PlayerBlockEventType.PLACE_VEHICLE;
break; break;
case PAINTING:
case ITEM_FRAME: case ITEM_FRAME:
case PAINTING:
location = BukkitUtil location = BukkitUtil
.getLocation(block.getRelative(event.getBlockFace()).getLocation()); .getLocation(block.getRelative(event.getBlockFace()).getLocation());
eventType = PlayerBlockEventType.PLACE_HANGING; eventType = PlayerBlockEventType.PLACE_HANGING;
@ -1985,15 +2002,22 @@ import java.util.regex.Pattern;
//TODO needs an overhaul for the increased number of spawn reasons added to this event. //TODO needs an overhaul for the increased number of spawn reasons added to this event.
//I can't believe they waited so damn long to expand this API set. //I can't believe they waited so damn long to expand this API set.
switch (reason) { switch (reason) {
case SPAWNER_EGG:
case DISPENSE_EGG: case DISPENSE_EGG:
case OCELOT_BABY:
case EGG: case EGG:
case OCELOT_BABY:
case SPAWNER_EGG:
if (!area.SPAWN_EGGS) { if (!area.SPAWN_EGGS) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
break; break;
case REINFORCEMENTS:
case NATURAL:
case CHUNK_GEN:
if (!area.MOB_SPAWNING) {
event.setCancelled(true);
return;
}
case BREEDING: case BREEDING:
if (!area.SPAWN_BREEDING) { if (!area.SPAWN_BREEDING) {
event.setCancelled(true); event.setCancelled(true);
@ -2001,8 +2025,8 @@ import java.util.regex.Pattern;
} }
break; break;
case BUILD_IRONGOLEM: case BUILD_IRONGOLEM:
case BUILD_WITHER:
case BUILD_SNOWMAN: case BUILD_SNOWMAN:
case BUILD_WITHER:
case CUSTOM: case CUSTOM:
if (!area.SPAWN_CUSTOM && entity.getType() != EntityType.ARMOR_STAND) { if (!area.SPAWN_CUSTOM && entity.getType() != EntityType.ARMOR_STAND) {
event.setCancelled(true); event.setCancelled(true);