From 835f4f5407f338b7d07411b85b3947e367e48c9a Mon Sep 17 00:00:00 2001 From: filoghost Date: Wed, 10 Jun 2020 19:22:30 +0200 Subject: [PATCH] Fix issue with signs on Minecraft 1.13+ --- .../filoghost/chestcommands/listener/SignListener.java | 3 +-- .../filoghost/chestcommands/util/MaterialsRegistry.java | 7 ------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/Plugin/src/main/java/com/gmail/filoghost/chestcommands/listener/SignListener.java b/Plugin/src/main/java/com/gmail/filoghost/chestcommands/listener/SignListener.java index 95bcae7..cb37d59 100644 --- a/Plugin/src/main/java/com/gmail/filoghost/chestcommands/listener/SignListener.java +++ b/Plugin/src/main/java/com/gmail/filoghost/chestcommands/listener/SignListener.java @@ -19,7 +19,6 @@ import com.gmail.filoghost.chestcommands.Permissions; import com.gmail.filoghost.chestcommands.api.IconMenu; import com.gmail.filoghost.chestcommands.internal.ExtendedIconMenu; import com.gmail.filoghost.chestcommands.util.BukkitUtils; -import com.gmail.filoghost.chestcommands.util.MaterialsRegistry; import org.bukkit.ChatColor; import org.bukkit.block.Sign; import org.bukkit.event.EventHandler; @@ -34,7 +33,7 @@ public class SignListener implements Listener { @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onInteract(PlayerInteractEvent event) { - if (event.getAction() == Action.RIGHT_CLICK_BLOCK && MaterialsRegistry.isSign(event.getClickedBlock().getType())) { + if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.hasBlock() && event.getClickedBlock().getState() instanceof Sign) { Sign sign = (Sign) event.getClickedBlock().getState(); if (sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE + "[menu]")) { diff --git a/Plugin/src/main/java/com/gmail/filoghost/chestcommands/util/MaterialsRegistry.java b/Plugin/src/main/java/com/gmail/filoghost/chestcommands/util/MaterialsRegistry.java index 90abb76..6bf47b7 100644 --- a/Plugin/src/main/java/com/gmail/filoghost/chestcommands/util/MaterialsRegistry.java +++ b/Plugin/src/main/java/com/gmail/filoghost/chestcommands/util/MaterialsRegistry.java @@ -36,9 +36,6 @@ public final class MaterialsRegistry { // Materials that are considered air (with 1.13+ compatibility) private static final Collection AIR_MATERIALS = getExistingMaterials("AIR", "CAVE_AIR", "VOID_AIR"); - // Materials that have a "Sign" block state (with 1.13+ compatibility) - private static final Collection SIGN_MATERIALS = getExistingMaterials("SIGN", "SIGN_POST", "WALL_SIGN"); - private MaterialsRegistry() { } @@ -84,10 +81,6 @@ public final class MaterialsRegistry { return AIR_MATERIALS.contains(material); } - public static boolean isSign(Material material) { - return SIGN_MATERIALS.contains(material); - } - public static boolean useNewMaterialNames() { return USE_NEW_MATERIAL_NAMES; }