From 45c566859e5212f6a8a8ac5deee6da83baa13095 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Mon, 21 Jun 2021 10:30:48 +0200 Subject: [PATCH] Don't fail loading on versions prior to 1.17 --- .../bukkit/listener/BlockEventListener.java | 4 ++-- .../bukkit/listener/PlayerEventListener.java | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java index 65f95d319..864a68b85 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java @@ -956,8 +956,8 @@ public class BlockEventListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockDispense(BlockDispenseEvent event) { Material type = event.getItem().getType(); - switch (type) { - case SHULKER_BOX, WHITE_SHULKER_BOX, ORANGE_SHULKER_BOX, MAGENTA_SHULKER_BOX, LIGHT_BLUE_SHULKER_BOX, YELLOW_SHULKER_BOX, LIME_SHULKER_BOX, PINK_SHULKER_BOX, GRAY_SHULKER_BOX, LIGHT_GRAY_SHULKER_BOX, CYAN_SHULKER_BOX, PURPLE_SHULKER_BOX, BLUE_SHULKER_BOX, BROWN_SHULKER_BOX, GREEN_SHULKER_BOX, RED_SHULKER_BOX, BLACK_SHULKER_BOX, CARVED_PUMPKIN, WITHER_SKELETON_SKULL, FLINT_AND_STEEL, BONE_MEAL, SHEARS, GLASS_BOTTLE, GLOWSTONE, COD_BUCKET, PUFFERFISH_BUCKET, SALMON_BUCKET, TROPICAL_FISH_BUCKET, AXOLOTL_BUCKET, BUCKET, WATER_BUCKET, LAVA_BUCKET -> { + switch (type.toString()) { + case "SHULKER_BOX", "WHITE_SHULKER_BOX", "ORANGE_SHULKER_BOX", "MAGENTA_SHULKER_BOX", "LIGHT_BLUE_SHULKER_BOX", "YELLOW_SHULKER_BOX", "LIME_SHULKER_BOX", "PINK_SHULKER_BOX", "GRAY_SHULKER_BOX", "LIGHT_GRAY_SHULKER_BOX", "CYAN_SHULKER_BOX", "PURPLE_SHULKER_BOX", "BLUE_SHULKER_BOX", "BROWN_SHULKER_BOX", "GREEN_SHULKER_BOX", "RED_SHULKER_BOX", "BLACK_SHULKER_BOX", "CARVED_PUMPKIN", "WITHER_SKELETON_SKULL", "FLINT_AND_STEEL", "BONE_MEAL", "SHEARS", "GLASS_BOTTLE", "GLOWSTONE", "COD_BUCKET", "PUFFERFISH_BUCKET", "SALMON_BUCKET", "TROPICAL_FISH_BUCKET", "AXOLOTL_BUCKET", "BUCKET", "WATER_BUCKET", "LAVA_BUCKET" -> { if (event.getBlock().getType() == Material.DROPPER) { return; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java index 91344e87c..35abbf5d9 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java @@ -1064,16 +1064,16 @@ public class PlayerEventListener extends PlotListener implements Listener { Material type = event.getMaterial(); // in the following, lb needs to have the material of the item in hand i.e. type - switch (type) { - case REDSTONE: - case STRING: - case PUMPKIN_SEEDS: - case MELON_SEEDS: - case COCOA_BEANS: - case WHEAT_SEEDS: - case BEETROOT_SEEDS: - case SWEET_BERRIES: - case GLOW_BERRIES: + switch (type.toString()) { + case "REDSTONE": + case "STRING": + case "PUMPKIN_SEEDS": + case "MELON_SEEDS": + case "COCOA_BEANS": + case "WHEAT_SEEDS": + case "BEETROOT_SEEDS": + case "SWEET_BERRIES": + case "GLOW_BERRIES": return; default: //eventType = PlayerBlockEventType.PLACE_BLOCK;