From b9f4edca03641e032c1245c78e28c53398ad324c Mon Sep 17 00:00:00 2001 From: filoghost Date: Sat, 8 Nov 2014 10:41:12 +0100 Subject: [PATCH] Possible bug fix. --- .../filoghost/chestcommands/listener/SignListener.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ChestCommands/src/com/gmail/filoghost/chestcommands/listener/SignListener.java b/ChestCommands/src/com/gmail/filoghost/chestcommands/listener/SignListener.java index 9b1c7e1..f7cb891 100644 --- a/ChestCommands/src/com/gmail/filoghost/chestcommands/listener/SignListener.java +++ b/ChestCommands/src/com/gmail/filoghost/chestcommands/listener/SignListener.java @@ -46,7 +46,6 @@ public class SignListener implements Listener { @EventHandler (priority = EventPriority.HIGH, ignoreCancelled = true) public void onSignChange(SignChangeEvent event) { - if (event.getLine(0).equalsIgnoreCase("[menu]") && event.getPlayer().hasPermission(Permissions.SIGN_CREATE)) { if (event.getLine(1).isEmpty()) { @@ -67,6 +66,14 @@ public class SignListener implements Listener { } } + @EventHandler (priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onSignChangeMonitor(SignChangeEvent event) { + // Prevent players with permissions for creating colored signs from creating menu signs. + if (event.getLine(0).equalsIgnoreCase(ChatColor.BLUE + "[menu]") && !event.getPlayer().hasPermission(Permissions.SIGN_CREATE)) { + event.setLine(0, ChatColor.stripColor(event.getLine(0))); + } + } + private boolean isSign(Material material) { return material == Material.WALL_SIGN || material == Material.SIGN_POST; }