From 6134d2b8688819767901081ffda1677e45510d3a Mon Sep 17 00:00:00 2001 From: zml2008 Date: Thu, 19 Jan 2012 15:21:18 -0800 Subject: [PATCH] Updated for slightly cleaner event handler syntax --- .../bukkit/util/FallbackRegistrationListener.java | 2 +- src/main/java/com/sk89q/util/yaml/YAMLProcessor.java | 5 ++++- .../com/sk89q/wepif/PermissionsResolverManager.java | 4 ++-- .../com/sk89q/worldedit/bukkit/WorldEditListener.java | 10 +++++----- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/sk89q/bukkit/util/FallbackRegistrationListener.java b/src/main/java/com/sk89q/bukkit/util/FallbackRegistrationListener.java index 5fc2a6a7b..a954f50a8 100644 --- a/src/main/java/com/sk89q/bukkit/util/FallbackRegistrationListener.java +++ b/src/main/java/com/sk89q/bukkit/util/FallbackRegistrationListener.java @@ -34,7 +34,7 @@ public class FallbackRegistrationListener implements Listener { this.commandRegistration = commandRegistration; } - @EventHandler(event = PlayerCommandPreprocessEvent.class) + @EventHandler public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { if (event.isCancelled()) { return; diff --git a/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java b/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java index 4c6ab188e..e6e2a19b5 100644 --- a/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java +++ b/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java @@ -72,7 +72,10 @@ public class YAMLProcessor extends YAMLNode { protected String header = null; protected YAMLFormat format; - // Map from property key to comment. Comment may have multiple lines that are newline-separated. + /* + * Map from property key to comment. Comment may have multiple lines that are newline-separated. + * Comments support based on ZerothAngel's AnnotatedYAMLConfiguration + */ private final Map comments = new HashMap(); public YAMLProcessor(File file, boolean writeDefaults, YAMLFormat format) { diff --git a/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java b/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java index ce009a476..e606a3cad 100644 --- a/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java +++ b/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java @@ -261,7 +261,7 @@ public class PermissionsResolverManager implements PermissionsResolver { } class ServerListener implements org.bukkit.event.Listener { - @EventHandler(event = PluginEnableEvent.class) + @EventHandler public void onPluginEnable(PluginEnableEvent event) { Plugin plugin = event.getPlugin(); String name = plugin.getDescription().getName(); @@ -272,7 +272,7 @@ public class PermissionsResolverManager implements PermissionsResolver { } } - @EventHandler(event = PluginDisableEvent.class) + @EventHandler public void onPluginDisable(PluginDisableEvent event) { String name = event.getPlugin().getDescription().getName(); diff --git a/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java b/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java index 87e7d1e7f..eaffe7fc1 100644 --- a/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java +++ b/src/main/java/com/sk89q/worldedit/bukkit/WorldEditListener.java @@ -62,7 +62,7 @@ public class WorldEditListener implements Listener { this.plugin = plugin; } - @EventHandler(event = PlayerJoinEvent.class, priority = EventPriority.LOWEST) + @EventHandler(priority = EventPriority.LOWEST) public void onPlayerJoin(PlayerJoinEvent event) { plugin.wrapPlayer(event.getPlayer()).dispatchCUIHandshake(); } @@ -72,7 +72,7 @@ public class WorldEditListener implements Listener { * * @param event Relevant event details */ - @EventHandler(event = PlayerQuitEvent.class) + @EventHandler public void onPlayerQuit(PlayerQuitEvent event) { plugin.getWorldEdit().markExpire(plugin.wrapPlayer(event.getPlayer())); } @@ -82,7 +82,7 @@ public class WorldEditListener implements Listener { * * @param event Relevant event details */ - @EventHandler(event = PlayerCommandPreprocessEvent.class, priority = EventPriority.LOW) + @EventHandler(priority = EventPriority.LOW) public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { if (event.isCancelled()) { return; @@ -103,7 +103,7 @@ public class WorldEditListener implements Listener { * * @param event Relevant event details */ - @EventHandler(event = PlayerInteractEvent.class) + @EventHandler public void onPlayerInteract(PlayerInteractEvent event) { if (event.useItemInHand() == Result.DENY) { return; @@ -167,7 +167,7 @@ public class WorldEditListener implements Listener { } } - @EventHandler(event = PlayerChatEvent.class) + @EventHandler public void onPlayerChat(PlayerChatEvent event) { if (event.isCancelled()) { return;