diff options
author | ElgarL <ElgarL@palmergames.com> | 2012-01-21 11:47:08 +0000 |
---|---|---|
committer | ElgarL <ElgarL@palmergames.com> | 2012-01-21 11:47:08 +0000 |
commit | 4b61ac9043ff6088c4910d497e8ee18e13d5494b (patch) | |
tree | cfa621a3b42dc0b411b4180bc44e7633e1a5f8ca /EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions | |
parent | 72edfacfb8ccdc44450ad9a9bee930d68f251db6 (diff) | |
download | Essentials-4b61ac9043ff6088c4910d497e8ee18e13d5494b.tar Essentials-4b61ac9043ff6088c4910d497e8ee18e13d5494b.tar.gz Essentials-4b61ac9043ff6088c4910d497e8ee18e13d5494b.tar.lz Essentials-4b61ac9043ff6088c4910d497e8ee18e13d5494b.tar.xz Essentials-4b61ac9043ff6088c4910d497e8ee18e13d5494b.zip |
Update to new Bukkit Event system.
Update GroupManagerBridge for new event system.
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions')
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java index e060daf85..f9363e04d 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java @@ -32,17 +32,17 @@ import org.anjocaido.groupmanager.dataholder.OverloadedWorldHolder; import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
-import org.bukkit.event.Event;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerKickEvent;
-import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
-import org.bukkit.event.server.ServerListener;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
@@ -105,20 +105,8 @@ public class BukkitPermissions { private void registerEvents() {
PluginManager manager = plugin.getServer().getPluginManager();
- PlayerEvents playerEventListener = new PlayerEvents();
-
- manager.registerEvent(Event.Type.PLAYER_JOIN, playerEventListener, Event.Priority.Lowest, plugin);
- manager.registerEvent(Event.Type.PLAYER_KICK, playerEventListener, Event.Priority.Lowest, plugin);
- manager.registerEvent(Event.Type.PLAYER_QUIT, playerEventListener, Event.Priority.Lowest, plugin);
-
- manager.registerEvent(Event.Type.PLAYER_RESPAWN, playerEventListener, Event.Priority.Lowest, plugin);
- manager.registerEvent(Event.Type.PLAYER_TELEPORT, playerEventListener, Event.Priority.Lowest, plugin);
- manager.registerEvent(Event.Type.PLAYER_PORTAL, playerEventListener, Event.Priority.Lowest, plugin);
-
- ServerListener serverListener = new BukkitEvents();
-
- manager.registerEvent(Event.Type.PLUGIN_ENABLE, serverListener, Event.Priority.Normal, plugin);
- manager.registerEvent(Event.Type.PLUGIN_DISABLE, serverListener, Event.Priority.Normal, plugin);
+ manager.registerEvents(new PlayerEvents(), plugin);
+ manager.registerEvents(new BukkitEvents(), plugin);
}
@@ -374,9 +362,9 @@ public class BukkitPermissions { }
}
- protected class PlayerEvents extends PlayerListener {
+ protected class PlayerEvents implements Listener {
- @Override
+ @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerJoin(PlayerJoinEvent event) {
setPlayer_join(true);
Player player = event.getPlayer();
@@ -388,26 +376,26 @@ public class BukkitPermissions { setPlayer_join(false);
}
- @Override
+ @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerPortal(PlayerPortalEvent event) { // will portal into another world
if (event.getTo() != null && !event.getFrom().getWorld().equals(event.getTo().getWorld())) { // only if world actually changed
updatePermissions(event.getPlayer(), event.getTo().getWorld().getName());
}
}
- @Override
+ @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerRespawn(PlayerRespawnEvent event) { // can be respawned in another world
updatePermissions(event.getPlayer(), event.getRespawnLocation().getWorld().getName());
}
- @Override
+ @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerTeleport(PlayerTeleportEvent event) { // can be teleported into another world
if (event.getTo() != null && !event.getFrom().getWorld().equals(event.getTo().getWorld())) { // only if world actually changed
updatePermissions(event.getPlayer(), event.getTo().getWorld().getName());
}
}
- @Override
+ @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerQuit(PlayerQuitEvent event) {
if (!GroupManager.isLoaded())
return;
@@ -415,15 +403,15 @@ public class BukkitPermissions { attachments.remove(event.getPlayer());
}
- @Override
+ @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerKick(PlayerKickEvent event) {
attachments.remove(event.getPlayer());
}
}
- protected class BukkitEvents extends ServerListener {
+ protected class BukkitEvents implements Listener {
- @Override
+ @EventHandler(priority = EventPriority.NORMAL)
public void onPluginEnable(PluginEnableEvent event) {
if (!GroupManager.isLoaded())
return;
@@ -432,7 +420,7 @@ public class BukkitPermissions { updateAllPlayers();
}
- @Override
+ @EventHandler(priority = EventPriority.NORMAL)
public void onPluginDisable(PluginDisableEvent event) {
collectPermissions();
// updateAllPlayers();
|