diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-01-31 08:06:50 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-01-31 08:06:50 +0000 |
commit | 2942ef40f3f78a5316885302da2512b0e4d52e27 (patch) | |
tree | 3a1d346a65d2ba044889982d016471f914667950 | |
parent | 8500542e934ce30f9bff8148340c001973ce46bb (diff) | |
download | Essentials-2942ef40f3f78a5316885302da2512b0e4d52e27.tar Essentials-2942ef40f3f78a5316885302da2512b0e4d52e27.tar.gz Essentials-2942ef40f3f78a5316885302da2512b0e4d52e27.tar.lz Essentials-2942ef40f3f78a5316885302da2512b0e4d52e27.tar.xz Essentials-2942ef40f3f78a5316885302da2512b0e4d52e27.zip |
Update jails to new event system.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/Jails.java | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Jails.java b/Essentials/src/com/earth2me/essentials/Jails.java index f8ab2d02e..7035fb859 100644 --- a/Essentials/src/com/earth2me/essentials/Jails.java +++ b/Essentials/src/com/earth2me/essentials/Jails.java @@ -1,18 +1,24 @@ package com.earth2me.essentials; +import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.api.IJails; import com.earth2me.essentials.storage.AsyncStorageObjectHolder; -import static com.earth2me.essentials.I18n._; import java.io.File; import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.event.Event.Priority; -import org.bukkit.event.Event.Type; -import org.bukkit.event.block.*; -import org.bukkit.event.player.*; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.plugin.PluginManager; @@ -33,13 +39,8 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett final PluginManager pluginManager = ess.getServer().getPluginManager(); final JailBlockListener blockListener = new JailBlockListener(); final JailPlayerListener playerListener = new JailPlayerListener(); - pluginManager.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Low, ess); - pluginManager.registerEvent(Type.BLOCK_DAMAGE, blockListener, Priority.Low, ess); - pluginManager.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Low, ess); - pluginManager.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.Low, ess); - pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, Priority.High, ess); - pluginManager.registerEvent(Type.PLAYER_TELEPORT, playerListener, Priority.High, ess); - pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.High, ess); + pluginManager.registerEvents(blockListener, ess); + pluginManager.registerEvents(playerListener, ess); } @Override @@ -146,9 +147,9 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett } - private class JailBlockListener extends BlockListener + private class JailBlockListener implements Listener { - @Override + @EventHandler(priority = EventPriority.LOW) public void onBlockBreak(final BlockBreakEvent event) { final User user = ess.getUser(event.getPlayer()); @@ -158,7 +159,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett } } - @Override + @EventHandler(priority = EventPriority.LOW) public void onBlockPlace(final BlockPlaceEvent event) { final User user = ess.getUser(event.getPlayer()); @@ -168,7 +169,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett } } - @Override + @EventHandler(priority = EventPriority.LOW) public void onBlockDamage(final BlockDamageEvent event) { final User user = ess.getUser(event.getPlayer()); @@ -180,9 +181,9 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett } - private class JailPlayerListener extends PlayerListener + private class JailPlayerListener implements Listener { - @Override + @EventHandler(priority = EventPriority.LOW) public void onPlayerInteract(final PlayerInteractEvent event) { final User user = ess.getUser(event.getPlayer()); @@ -192,7 +193,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett } } - @Override + @EventHandler(priority = EventPriority.HIGH) public void onPlayerRespawn(final PlayerRespawnEvent event) { final User user = ess.getUser(event.getPlayer()); @@ -211,7 +212,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett } } - @Override + @EventHandler(priority = EventPriority.HIGH) public void onPlayerTeleport(final PlayerTeleportEvent event) { final User user = ess.getUser(event.getPlayer()); @@ -231,7 +232,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett user.sendMessage(_("jailMessage")); } - @Override + @EventHandler(priority = EventPriority.HIGH) public void onPlayerJoin(final PlayerJoinEvent event) { final User user = ess.getUser(event.getPlayer()); |