summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager/src/org
diff options
context:
space:
mode:
Diffstat (limited to 'EssentialsGroupManager/src/org')
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java4
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java13
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java15
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java13
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java11
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java42
6 files changed, 63 insertions, 35 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
index 76b9e46b2..db2e60fda 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
@@ -38,8 +38,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
-import org.bukkit.event.Event.Priority;
-import org.bukkit.event.world.WorldListener;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.ServicePriority;
import org.bukkit.plugin.java.JavaPlugin;
@@ -82,7 +80,7 @@ public class GroupManager extends JavaPlugin {
private GMLoggerHandler ch;
public static BukkitPermissions BukkitPermissions;
- private static WorldListener WorldEvents;
+ private static GMWorldListener WorldEvents;
public static final Logger logger = Logger.getLogger(GroupManager.class.getName());
// PERMISSIONS FOR COMMAND BEING LOADED
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java
index 9a44a21b8..4482f3d9e 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java
@@ -1,6 +1,7 @@
package org.anjocaido.groupmanager.events;
import org.anjocaido.groupmanager.data.Group;
+import org.bukkit.event.HandlerList;
/**
@@ -13,6 +14,18 @@ public class GMGroupEvent extends GroupManagerEvent {
*
*/
private static final long serialVersionUID = -5294917600434510451L;
+ private static final HandlerList handlers = new HandlerList();
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ //////////////////////////////
protected Group group;
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java
index f7ecf79de..eb4b95c03 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java
@@ -1,5 +1,7 @@
package org.anjocaido.groupmanager.events;
+import org.bukkit.event.HandlerList;
+
/**
* @author ElgarL
@@ -11,6 +13,19 @@ public class GMSystemEvent extends GroupManagerEvent {
*
*/
private static final long serialVersionUID = -8786811924448821548L;
+ private static final HandlerList handlers = new HandlerList();
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ //////////////////////////////
+
protected Action action;
public GMSystemEvent(Action action) {
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java
index 68483c036..efa591562 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java
@@ -1,6 +1,7 @@
package org.anjocaido.groupmanager.events;
import org.anjocaido.groupmanager.data.User;
+import org.bukkit.event.HandlerList;
/**
@@ -13,6 +14,18 @@ public class GMUserEvent extends GroupManagerEvent {
*
*/
private static final long serialVersionUID = -5294917600434510451L;
+ private static final HandlerList handlers = new HandlerList();
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ //////////////////////////////
protected User user;
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java
index 037971314..fd1a9d7ff 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java
@@ -1,9 +1,10 @@
package org.anjocaido.groupmanager.events;
import org.anjocaido.groupmanager.GroupManager;
-import org.bukkit.event.Event;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
import org.bukkit.event.world.WorldInitEvent;
-import org.bukkit.event.world.WorldListener;
/**
@@ -12,7 +13,7 @@ import org.bukkit.event.world.WorldListener;
* Handle new world creation from other plugins
*
*/
-public class GMWorldListener extends WorldListener {
+public class GMWorldListener implements Listener {
private final GroupManager plugin;
@@ -22,10 +23,10 @@ public class GMWorldListener extends WorldListener {
}
private void registerEvents() {
- plugin.getServer().getPluginManager().registerEvent(Event.Type.WORLD_INIT, this, Event.Priority.Lowest, plugin);
+ plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
- @Override
+ @EventHandler(priority = EventPriority.LOWEST)
public void onWorldInit(WorldInitEvent event) {
String worldName = event.getWorld().getName();
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();