summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager/src/org
diff options
context:
space:
mode:
authorElgarL <ElgarL@palmergames.com>2011-12-29 14:52:42 +0000
committerElgarL <ElgarL@palmergames.com>2011-12-29 14:52:42 +0000
commit3aba996e97bd5bb90e65ed3166f3666d9122a729 (patch)
treec06fd28d7ee9629d621072d1030246f12c49dc6d /EssentialsGroupManager/src/org
parent69847af08aa1ebc91c7808310bb7c7c1183b137f (diff)
downloadEssentials-3aba996e97bd5bb90e65ed3166f3666d9122a729.tar
Essentials-3aba996e97bd5bb90e65ed3166f3666d9122a729.tar.gz
Essentials-3aba996e97bd5bb90e65ed3166f3666d9122a729.tar.lz
Essentials-3aba996e97bd5bb90e65ed3166f3666d9122a729.tar.xz
Essentials-3aba996e97bd5bb90e65ed3166f3666d9122a729.zip
Changed the way events are raised to prevent variable corruption.
Diffstat (limited to 'EssentialsGroupManager/src/org')
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java19
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEvent.java22
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java8
3 files changed, 24 insertions, 25 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
index 5ced1fb47..c0e9ef2f8 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
@@ -1837,25 +1837,6 @@ public class GroupManager extends JavaPlugin {
return match;
}
-
- /**
- * Triggers all GroupManager events for other plugins to see.
- * Schedules events for 1 tick later to allow GM to finish populating super perms.
- *
- * @param event
- */
- public static void callEvent(final GroupManagerEvent event) {
-
- if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() {
-
- @Override
- public void run() {
- Bukkit.getServer().getPluginManager().callEvent(event);
- }
- }) == -1)
- GroupManager.logger.warning("Could not schedule GM Event.");
-
- }
/**
* @return the config
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEvent.java
index 856abbc28..0834b3ada 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEvent.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEvent.java
@@ -1,6 +1,8 @@
package org.anjocaido.groupmanager.events;
+import org.anjocaido.groupmanager.GroupManager;
+import org.bukkit.Bukkit;
import org.bukkit.event.Event;
/**
@@ -13,10 +15,28 @@ public abstract class GroupManagerEvent extends Event {
*
*/
private static final long serialVersionUID = 8790362185329926951L;
-
+
protected GroupManagerEvent(String name) {
super(name);
}
+ /**
+ * Triggers all GroupManager events for other plugins to see.
+ * Schedules events for 1 tick later to allow GM to finish populating super perms.
+ *
+ * @param event
+ */
+ public void schedule(final GroupManagerEvent event) {
+
+ if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() {
+
+ @Override
+ public void run() {
+ Bukkit.getServer().getPluginManager().callEvent(event);
+ }
+ }, 1) == -1)
+ GroupManager.logger.warning("Could not schedule GM Event.");
+ }
+
} \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java
index 83cac393d..3c077b6c6 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java
@@ -1,11 +1,9 @@
package org.anjocaido.groupmanager.events;
-import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.data.Group;
import org.anjocaido.groupmanager.data.User;
-
/**
* @author ElgarL
*
@@ -13,13 +11,13 @@ import org.anjocaido.groupmanager.data.User;
public class GroupManagerEventHandler {
protected static void callEvent(GMGroupEvent event) {
- GroupManager.callEvent(event);
+ event.schedule(event);
}
protected static void callEvent(GMUserEvent event) {
- GroupManager.callEvent(event);
+ event.schedule(event);
}
protected static void callEvent(GMSystemEvent event) {
- GroupManager.callEvent(event);
+ event.schedule(event);
}
public static void callEvent(Group group, GMGroupEvent.Action action) {