diff options
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEvent.java')
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEvent.java | 22 |
1 files changed, 21 insertions, 1 deletions
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 |