summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElgarL <ElgarL@palmergames.com>2011-12-13 17:32:39 +0000
committerElgarL <ElgarL@palmergames.com>2011-12-13 17:32:39 +0000
commit5b195299badac21ae3a16de49d62a32866d00f19 (patch)
tree8c81b260488cae517c52b4d99d4ac76389d980a9
parent759892078ad99db2bb548f32b5588b51a5433ee3 (diff)
downloadEssentials-5b195299badac21ae3a16de49d62a32866d00f19.tar
Essentials-5b195299badac21ae3a16de49d62a32866d00f19.tar.gz
Essentials-5b195299badac21ae3a16de49d62a32866d00f19.tar.lz
Essentials-5b195299badac21ae3a16de49d62a32866d00f19.tar.xz
Essentials-5b195299badac21ae3a16de49d62a32866d00f19.zip
Update event Action names to be unique
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java6
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java8
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java56
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java32
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java58
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEvent.java22
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java42
7 files changed, 217 insertions, 7 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
index a0b50bf5b..5a39600b6 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java
@@ -119,7 +119,7 @@ public class Group extends DataUnit implements Cloneable {
flagAsChanged();
if (GroupManager.isLoaded()) {
GroupManager.BukkitPermissions.updateAllPlayers();
- GroupManagerEventHandler.callEvent(this, Action.INHERITANCE_CHANGED);
+ GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
}
}
@@ -127,7 +127,7 @@ public class Group extends DataUnit implements Cloneable {
if (this.inherits.contains(inherit.toLowerCase())) {
this.inherits.remove(inherit.toLowerCase());
flagAsChanged();
- GroupManagerEventHandler.callEvent(this, Action.INHERITANCE_CHANGED);
+ GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
return true;
}
return false;
@@ -153,7 +153,7 @@ public class Group extends DataUnit implements Cloneable {
flagAsChanged();
if (GroupManager.isLoaded()) {
GroupManager.BukkitPermissions.updateAllPlayers();
- GroupManagerEventHandler.callEvent(this, Action.INFO_CHANGED);
+ GroupManagerEventHandler.callEvent(this, Action.GROUP_INFO_CHANGED);
}
}
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
index 81d188c80..1f2be9875 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
@@ -143,7 +143,7 @@ public class User extends DataUnit implements Cloneable {
if (notify)
GroupManager.notify(this.getName(), String.format(" moved to the group %s.", group.getName()));
- GroupManagerEventHandler.callEvent(this, Action.GROUP_CHANGED);
+ GroupManagerEventHandler.callEvent(this, Action.USER_GROUP_CHANGED);
}
}
@@ -161,7 +161,7 @@ public class User extends DataUnit implements Cloneable {
if (GroupManager.isLoaded()) {
if (GroupManager.BukkitPermissions.player_join = false)
GroupManager.BukkitPermissions.updateAllPlayers();
- GroupManagerEventHandler.callEvent(this, Action.SUBGROUP_CHANGED);
+ GroupManagerEventHandler.callEvent(this, Action.USER_SUBGROUP_CHANGED);
}
}
@@ -184,7 +184,7 @@ public class User extends DataUnit implements Cloneable {
if (GroupManager.isLoaded())
if (GroupManager.BukkitPermissions.player_join = false)
GroupManager.BukkitPermissions.updateAllPlayers();
- GroupManagerEventHandler.callEvent(this, Action.SUBGROUP_CHANGED);
+ GroupManagerEventHandler.callEvent(this, Action.USER_SUBGROUP_CHANGED);
return true;
}
} catch (Exception e) {
@@ -231,7 +231,7 @@ public class User extends DataUnit implements Cloneable {
if (GroupManager.isLoaded()) {
if (GroupManager.BukkitPermissions.player_join = false)
GroupManager.BukkitPermissions.updateAllPlayers();
- GroupManagerEventHandler.callEvent(this, Action.INFO_CHANGED);
+ GroupManagerEventHandler.callEvent(this, Action.USER_INFO_CHANGED);
}
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java
new file mode 100644
index 000000000..cd31758e5
--- /dev/null
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java
@@ -0,0 +1,56 @@
+package org.anjocaido.groupmanager.events;
+
+import org.anjocaido.groupmanager.data.Group;
+
+
+/**
+ * @author ElgarL
+ *
+ */
+public class GMGroupEvent extends GroupManagerEvent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -5294917600434510451L;
+
+ protected Group group;
+
+ protected String groupName;
+
+ protected Action action;
+
+ public GMGroupEvent(Group group, Action action) {
+ super(action.toString());
+
+ this.group = group;
+ this.action = action;
+ }
+
+ public GMGroupEvent(String groupName, Action action) {
+ super(action.toString());
+
+ this.groupName = groupName;
+ this.action = action;
+ }
+
+ public Action getAction(){
+ return this.action;
+ }
+
+ public Group getGroup() {
+ return group;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public enum Action {
+ GROUP_PERMISSIONS_CHANGED,
+ GROUP_INHERITANCE_CHANGED,
+ GROUP_INFO_CHANGED,
+ GROUP_ADDED,
+ GROUP_REMOVED,
+ }
+} \ 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
new file mode 100644
index 000000000..f7ecf79de
--- /dev/null
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java
@@ -0,0 +1,32 @@
+package org.anjocaido.groupmanager.events;
+
+
+/**
+ * @author ElgarL
+ *
+ */
+public class GMSystemEvent extends GroupManagerEvent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -8786811924448821548L;
+ protected Action action;
+
+ public GMSystemEvent(Action action) {
+ super(action.toString());
+
+ this.action = action;
+ }
+
+ public Action getAction(){
+ return this.action;
+ }
+
+ public enum Action {
+ RELOADED,
+ SAVED,
+ DEFAULT_GROUP_CHANGED,
+ VALIDATE_TOGGLE,
+ }
+} \ 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
new file mode 100644
index 000000000..ef84b075e
--- /dev/null
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java
@@ -0,0 +1,58 @@
+package org.anjocaido.groupmanager.events;
+
+import org.anjocaido.groupmanager.data.User;
+
+
+/**
+ * @author ElgarL
+ *
+ */
+public class GMUserEvent extends GroupManagerEvent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -5294917600434510451L;
+
+ protected User user;
+
+ protected String userName;
+
+ protected Action action;
+
+ public GMUserEvent(User user, Action action) {
+ super(action.toString());
+
+ this.user = user;
+ this.action = action;
+ }
+
+ public GMUserEvent(String userName, Action action) {
+ super(action.toString());
+
+ this.userName = userName;
+ this.action = action;
+ }
+
+ public Action getAction(){
+ return this.action;
+ }
+
+ public User getUser() {
+ return user;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public enum Action {
+ USER_PERMISSIONS_CHANGED,
+ USER_INHERITANCE_CHANGED,
+ USER_INFO_CHANGED,
+ USER_GROUP_CHANGED,
+ USER_SUBGROUP_CHANGED,
+ USER_ADDED,
+ USER_REMOVED,
+ }
+} \ 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
new file mode 100644
index 000000000..856abbc28
--- /dev/null
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEvent.java
@@ -0,0 +1,22 @@
+package org.anjocaido.groupmanager.events;
+
+
+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);
+ }
+
+
+} \ 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
new file mode 100644
index 000000000..83cac393d
--- /dev/null
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java
@@ -0,0 +1,42 @@
+package org.anjocaido.groupmanager.events;
+
+import org.anjocaido.groupmanager.GroupManager;
+import org.anjocaido.groupmanager.data.Group;
+import org.anjocaido.groupmanager.data.User;
+
+
+
+/**
+ * @author ElgarL
+ *
+ */
+public class GroupManagerEventHandler {
+
+ protected static void callEvent(GMGroupEvent event) {
+ GroupManager.callEvent(event);
+ }
+ protected static void callEvent(GMUserEvent event) {
+ GroupManager.callEvent(event);
+ }
+ protected static void callEvent(GMSystemEvent event) {
+ GroupManager.callEvent(event);
+ }
+
+ public static void callEvent(Group group, GMGroupEvent.Action action) {
+ callEvent(new GMGroupEvent(group, action));
+ }
+ public static void callEvent(String groupName, GMGroupEvent.Action action) {
+ callEvent(new GMGroupEvent(groupName, action));
+ }
+
+ public static void callEvent(User user, GMUserEvent.Action action) {
+ callEvent(new GMUserEvent(user, action));
+ }
+ public static void callEvent(String userName, GMUserEvent.Action action) {
+ callEvent(new GMUserEvent(userName, action));
+ }
+
+ public static void callEvent(GMSystemEvent.Action action) {
+ callEvent(new GMSystemEvent(action));
+ }
+} \ No newline at end of file