diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/patches/commandsign/CommandSign.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/patches/commandsign/CommandSign.java index ad793b075..8868c5bb7 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/patches/commandsign/CommandSign.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/patches/commandsign/CommandSign.java @@ -11,7 +11,7 @@ import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; -public class CommandSign extends AEFModule { +public class CommandSign extends AEFModule implements Listener { private final Listener signCommandListener; @@ -21,16 +21,7 @@ public CommandSign() { "Patch signs that have run_command NBT tags attached, allowing the \n" + "to run a command with operator permissions on click. \n" + "Recommended to enable if you had a rogue admin or backdoor incident."); - this.signCommandListener = SignCommandListener.isSupported() ? new SignCommandListener() : new Listener() { - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - private void onInteract(PlayerInteractEvent event) { - if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return; - if (!MaterialUtil.SIGNS.contains(event.getClickedBlock().getType())) return; - if (!CachingPermTool.hasPermission(AEFPermission.BYPASS_PREVENTION_COMMANDSIGN, event.getPlayer())) { - event.setCancelled(true); - } - } - }; + this.signCommandListener = SignCommandListener.isSupported() ? new SignCommandListener() : this; } @Override @@ -47,4 +38,15 @@ public boolean shouldEnable() { public void disable() { HandlerList.unregisterAll(signCommandListener); } + + // Fallback listener, just cancels any right-clicking on signs + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + private void onInteract(PlayerInteractEvent event) { + if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return; + if (!MaterialUtil.SIGNS.contains(event.getClickedBlock().getType())) return; + + if (!CachingPermTool.hasPermission(AEFPermission.BYPASS_PREVENTION_COMMANDSIGN, event.getPlayer())) { + event.setCancelled(true); + } + } }