Don't fail loading on versions prior to 1.17

This commit is contained in:
NotMyFault 2021-06-21 10:30:48 +02:00
parent 654f7ed3ae
commit 45c566859e
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
2 changed files with 12 additions and 12 deletions

View File

@ -956,8 +956,8 @@ public class BlockEventListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockDispense(BlockDispenseEvent event) { public void onBlockDispense(BlockDispenseEvent event) {
Material type = event.getItem().getType(); Material type = event.getItem().getType();
switch (type) { 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 -> { 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) { if (event.getBlock().getType() == Material.DROPPER) {
return; return;
} }

View File

@ -1064,16 +1064,16 @@ public class PlayerEventListener extends PlotListener implements Listener {
Material type = event.getMaterial(); Material type = event.getMaterial();
// in the following, lb needs to have the material of the item in hand i.e. type // in the following, lb needs to have the material of the item in hand i.e. type
switch (type) { switch (type.toString()) {
case REDSTONE: case "REDSTONE":
case STRING: case "STRING":
case PUMPKIN_SEEDS: case "PUMPKIN_SEEDS":
case MELON_SEEDS: case "MELON_SEEDS":
case COCOA_BEANS: case "COCOA_BEANS":
case WHEAT_SEEDS: case "WHEAT_SEEDS":
case BEETROOT_SEEDS: case "BEETROOT_SEEDS":
case SWEET_BERRIES: case "SWEET_BERRIES":
case GLOW_BERRIES: case "GLOW_BERRIES":
return; return;
default: default:
//eventType = PlayerBlockEventType.PLACE_BLOCK; //eventType = PlayerBlockEventType.PLACE_BLOCK;