From 9905d22ddf1817f407746464308b3877b4d1821b Mon Sep 17 00:00:00 2001 From: wizjany Date: Tue, 19 May 2020 14:50:46 -0400 Subject: [PATCH] Add dyes as tools for interact handling. --- .../listener/EventAbstractionListener.java | 2 + .../worldguard/bukkit/util/Materials.java | 50 +++++++++++++------ 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java index e76fef78..af05a42f 100644 --- a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java +++ b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java @@ -283,6 +283,8 @@ public void onEntityChangeBlock(EntityChangeBlockEvent event) { if (trample) { placeDelegate.setSilent(true); placeDelegate.getRelevantFlags().add(Flags.TRAMPLE_BLOCKS); + } else if (fromType == Material.REDSTONE_ORE) { + placeDelegate.setSilent(true); } denied = Events.fireToCancel(event, placeDelegate); } diff --git a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java index b0b9272a..cdc4c3e3 100644 --- a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java +++ b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java @@ -547,22 +547,22 @@ public final class Materials { MATERIAL_FLAGS.put(Material.COD, 0); MATERIAL_FLAGS.put(Material.COOKED_COD, 0); MATERIAL_FLAGS.put(Material.INK_SAC, 0); - MATERIAL_FLAGS.put(Material.BLACK_DYE, MODIFIES_BLOCKS); - MATERIAL_FLAGS.put(Material.BLUE_DYE, MODIFIES_BLOCKS); - MATERIAL_FLAGS.put(Material.BROWN_DYE, MODIFIES_BLOCKS); - MATERIAL_FLAGS.put(Material.CYAN_DYE, MODIFIES_BLOCKS); - MATERIAL_FLAGS.put(Material.GRAY_DYE, MODIFIES_BLOCKS); - MATERIAL_FLAGS.put(Material.GREEN_DYE, MODIFIES_BLOCKS); - MATERIAL_FLAGS.put(Material.LIGHT_BLUE_DYE, MODIFIES_BLOCKS); - MATERIAL_FLAGS.put(Material.LIGHT_GRAY_DYE, MODIFIES_BLOCKS); - MATERIAL_FLAGS.put(Material.LIME_DYE, MODIFIES_BLOCKS); - MATERIAL_FLAGS.put(Material.MAGENTA_DYE, MODIFIES_BLOCKS); - MATERIAL_FLAGS.put(Material.ORANGE_DYE, MODIFIES_BLOCKS); - MATERIAL_FLAGS.put(Material.PINK_DYE, MODIFIES_BLOCKS); - MATERIAL_FLAGS.put(Material.PURPLE_DYE, MODIFIES_BLOCKS); - MATERIAL_FLAGS.put(Material.RED_DYE, MODIFIES_BLOCKS); - MATERIAL_FLAGS.put(Material.WHITE_DYE, MODIFIES_BLOCKS); - MATERIAL_FLAGS.put(Material.YELLOW_DYE, MODIFIES_BLOCKS); + MATERIAL_FLAGS.put(Material.BLACK_DYE, 0); + MATERIAL_FLAGS.put(Material.BLUE_DYE, 0); + MATERIAL_FLAGS.put(Material.BROWN_DYE, 0); + MATERIAL_FLAGS.put(Material.CYAN_DYE, 0); + MATERIAL_FLAGS.put(Material.GRAY_DYE, 0); + MATERIAL_FLAGS.put(Material.GREEN_DYE, 0); + MATERIAL_FLAGS.put(Material.LIGHT_BLUE_DYE, 0); + MATERIAL_FLAGS.put(Material.LIGHT_GRAY_DYE, 0); + MATERIAL_FLAGS.put(Material.LIME_DYE, 0); + MATERIAL_FLAGS.put(Material.MAGENTA_DYE, 0); + MATERIAL_FLAGS.put(Material.ORANGE_DYE, 0); + MATERIAL_FLAGS.put(Material.PINK_DYE, 0); + MATERIAL_FLAGS.put(Material.PURPLE_DYE, 0); + MATERIAL_FLAGS.put(Material.RED_DYE, 0); + MATERIAL_FLAGS.put(Material.WHITE_DYE, 0); + MATERIAL_FLAGS.put(Material.YELLOW_DYE, 0); MATERIAL_FLAGS.put(Material.COCOA_BEANS, 0); MATERIAL_FLAGS.put(Material.BONE_MEAL, MODIFIES_BLOCKS); MATERIAL_FLAGS.put(Material.BONE, 0); @@ -1392,6 +1392,7 @@ public static boolean isToolApplicable(Material toolMaterial, Material targetMat case GRASS_BLOCK: case DIRT: case GRASS_PATH: + // case COARSE_DIRT: // already handled by the server... return true; } return false; @@ -1435,6 +1436,23 @@ public static boolean isToolApplicable(Material toolMaterial, Material targetMat return true; } return false; + case BLACK_DYE: + case BLUE_DYE: + case BROWN_DYE: + case CYAN_DYE: + case GRAY_DYE: + case GREEN_DYE: + case LIGHT_BLUE_DYE: + case LIGHT_GRAY_DYE: + case LIME_DYE: + case MAGENTA_DYE: + case ORANGE_DYE: + case PINK_DYE: + case PURPLE_DYE: + case RED_DYE: + case WHITE_DYE: + case YELLOW_DYE: + return Tag.SIGNS.isTagged(targetMaterial); default: return false; }