Possible bug fix.

This commit is contained in:
filoghost 2014-11-08 10:41:12 +01:00
parent 310797d02a
commit b9f4edca03

View File

@ -46,7 +46,6 @@ public class SignListener implements Listener {
@EventHandler (priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler (priority = EventPriority.HIGH, ignoreCancelled = true)
public void onSignChange(SignChangeEvent event) { public void onSignChange(SignChangeEvent event) {
if (event.getLine(0).equalsIgnoreCase("[menu]") && event.getPlayer().hasPermission(Permissions.SIGN_CREATE)) { if (event.getLine(0).equalsIgnoreCase("[menu]") && event.getPlayer().hasPermission(Permissions.SIGN_CREATE)) {
if (event.getLine(1).isEmpty()) { 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) { private boolean isSign(Material material) {
return material == Material.WALL_SIGN || material == Material.SIGN_POST; return material == Material.WALL_SIGN || material == Material.SIGN_POST;
} }