diff options
author | ElgarL <ElgarL@palmergames.com> | 2012-01-21 20:18:40 +0000 |
---|---|---|
committer | ElgarL <ElgarL@palmergames.com> | 2012-01-21 20:18:40 +0000 |
commit | 6e03ea7b7deee8923d0c6804c105a3595838af9b (patch) | |
tree | 2bfa0bfa8e60d8698976cccff050e365ccf7867c /EssentialsGroupManager/src/org | |
parent | 9041596384c53e2d6fd03ba527b2787caba1dfe0 (diff) | |
download | Essentials-6e03ea7b7deee8923d0c6804c105a3595838af9b.tar Essentials-6e03ea7b7deee8923d0c6804c105a3595838af9b.tar.gz Essentials-6e03ea7b7deee8923d0c6804c105a3595838af9b.tar.lz Essentials-6e03ea7b7deee8923d0c6804c105a3595838af9b.tar.xz Essentials-6e03ea7b7deee8923d0c6804c105a3595838af9b.zip |
Separated all events to be independent classes.
Diffstat (limited to 'EssentialsGroupManager/src/org')
6 files changed, 50 insertions, 46 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index db2e60fda..d8f5418ed 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -26,7 +26,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.anjocaido.groupmanager.dataholder.worlds.WorldsHolder; import org.anjocaido.groupmanager.events.GMWorldListener; -import org.anjocaido.groupmanager.events.GroupManagerEvent; import org.anjocaido.groupmanager.utils.GMLoggerHandler; import org.anjocaido.groupmanager.utils.PermissionCheckResult; import org.anjocaido.groupmanager.utils.Tasks; diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java index 4482f3d9e..fdb740646 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java @@ -1,6 +1,9 @@ package org.anjocaido.groupmanager.events;
+import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.data.Group;
+import org.bukkit.Bukkit;
+import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@@ -8,7 +11,7 @@ import org.bukkit.event.HandlerList; * @author ElgarL
*
*/
-public class GMGroupEvent extends GroupManagerEvent {
+public class GMGroupEvent extends Event {
/**
*
@@ -67,4 +70,16 @@ public class GMGroupEvent extends GroupManagerEvent { GROUP_ADDED,
GROUP_REMOVED,
}
+
+ public void schedule(final GMGroupEvent 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/GMSystemEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java index eb4b95c03..1ff605d5c 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java @@ -1,5 +1,8 @@ package org.anjocaido.groupmanager.events;
+import org.anjocaido.groupmanager.GroupManager;
+import org.bukkit.Bukkit;
+import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@@ -7,7 +10,7 @@ import org.bukkit.event.HandlerList; * @author ElgarL
*
*/
-public class GMSystemEvent extends GroupManagerEvent {
+public class GMSystemEvent extends Event {
/**
*
@@ -44,4 +47,16 @@ public class GMSystemEvent extends GroupManagerEvent { DEFAULT_GROUP_CHANGED,
VALIDATE_TOGGLE,
}
+
+ public void schedule(final GMSystemEvent 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/GMUserEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java index efa591562..d40a7d63e 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java @@ -1,6 +1,9 @@ package org.anjocaido.groupmanager.events;
+import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.data.User;
+import org.bukkit.Bukkit;
+import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@@ -8,7 +11,7 @@ import org.bukkit.event.HandlerList; * @author ElgarL
*
*/
-public class GMUserEvent extends GroupManagerEvent {
+public class GMUserEvent extends Event {
/**
*
@@ -69,4 +72,16 @@ public class GMUserEvent extends GroupManagerEvent { USER_ADDED,
USER_REMOVED,
}
+
+ public void schedule(final GMUserEvent 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/GroupManagerEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEvent.java deleted file mode 100644 index 0834b3ada..000000000 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEvent.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.anjocaido.groupmanager.events;
-
-
-import org.anjocaido.groupmanager.GroupManager;
-import org.bukkit.Bukkit;
-import org.bukkit.event.Event;
-
-/**
- * @author ElgarL
- *
- */
-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 3c077b6c6..3a4d8d266 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java @@ -6,6 +6,8 @@ import org.anjocaido.groupmanager.data.User; /**
* @author ElgarL
+ *
+ * Handles all Event generation.
*
*/
public class GroupManagerEventHandler {
|