summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2012-01-24 03:43:17 +0100
committersnowleo <schneeleo@gmail.com>2012-01-24 03:43:17 +0100
commit0ea41d9169208b897c82b5ec45e641a9e1f9aaf1 (patch)
tree38bbe00c95188843bbb9d54e87c3543ed0c88352
parentf93769dd1dd11ef30c77dd6c9e0e5cf275052715 (diff)
parent125ea7c701c365c0a903c436ef92577742eaad5f (diff)
downloadEssentials-0ea41d9169208b897c82b5ec45e641a9e1f9aaf1.tar
Essentials-0ea41d9169208b897c82b5ec45e641a9e1f9aaf1.tar.gz
Essentials-0ea41d9169208b897c82b5ec45e641a9e1f9aaf1.tar.lz
Essentials-0ea41d9169208b897c82b5ec45e641a9e1f9aaf1.tar.xz
Essentials-0ea41d9169208b897c82b5ec45e641a9e1f9aaf1.zip
Merge branch 'refs/heads/groupmanager'
-rw-r--r--EssentialsGroupManager/src/Changelog.txt5
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java1
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java12
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java17
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java17
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java17
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEvent.java42
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java2
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java15
9 files changed, 71 insertions, 57 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt
index 456283c63..b58f520a8 100644
--- a/EssentialsGroupManager/src/Changelog.txt
+++ b/EssentialsGroupManager/src/Changelog.txt
@@ -108,4 +108,7 @@ v 1.9:
- Better optimize assembling of a players permissions and allow the * node to populate all registered superperms.
- Fixed text when adding a subgroup to not say the player was moved.
- Update to new Bukkit Event system.
- - Update GroupManagerBridge for new event system. \ No newline at end of file
+ - Update GroupManagerBridge for new event system.
+ - Fixed a random null error upon a player portaling.
+ - Fixed infinite loop error on player join.
+ - Optimized code to only update the player logging in instead of all players online. \ No newline at end of file
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/data/User.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
index d41f96b0d..fd66bcfa2 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
@@ -114,7 +114,7 @@ public class User extends DataUnit implements Cloneable {
flagAsChanged();
if (GroupManager.isLoaded())
if (!GroupManager.BukkitPermissions.isPlayer_join())
- GroupManager.BukkitPermissions.updateAllPlayers();
+ GroupManager.BukkitPermissions.updatePlayer(getBukkitPlayer());
}
/**
@@ -131,7 +131,7 @@ public class User extends DataUnit implements Cloneable {
flagAsChanged();
if (GroupManager.isLoaded()) {
if (!GroupManager.BukkitPermissions.isPlayer_join())
- GroupManager.BukkitPermissions.updateAllPlayers();
+ GroupManager.BukkitPermissions.updatePlayer(getBukkitPlayer());
// Do we notify of the group change?
String defaultGroupName = getDataSource().getDefaultGroup().getName();
@@ -160,7 +160,7 @@ public class User extends DataUnit implements Cloneable {
flagAsChanged();
if (GroupManager.isLoaded()) {
if (!GroupManager.BukkitPermissions.isPlayer_join())
- GroupManager.BukkitPermissions.updateAllPlayers();
+ GroupManager.BukkitPermissions.updatePlayer(getBukkitPlayer());
GroupManagerEventHandler.callEvent(this, Action.USER_SUBGROUP_CHANGED);
}
}
@@ -183,7 +183,7 @@ public class User extends DataUnit implements Cloneable {
flagAsChanged();
if (GroupManager.isLoaded())
if (!GroupManager.BukkitPermissions.isPlayer_join())
- GroupManager.BukkitPermissions.updateAllPlayers();
+ GroupManager.BukkitPermissions.updatePlayer(getBukkitPlayer());
GroupManagerEventHandler.callEvent(this, Action.USER_SUBGROUP_CHANGED);
return true;
}
@@ -229,8 +229,8 @@ public class User extends DataUnit implements Cloneable {
}
flagAsChanged();
if (GroupManager.isLoaded()) {
- if (!GroupManager.BukkitPermissions.isPlayer_join())
- GroupManager.BukkitPermissions.updateAllPlayers();
+ //if (!GroupManager.BukkitPermissions.isPlayer_join())
+ // GroupManager.BukkitPermissions.updatePlayer(this.getName());
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
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 {
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
index f9363e04d..481779c3c 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
@@ -122,7 +122,6 @@ public class BukkitPermissions {
registeredPermissions = new LinkedList<Permission>(Bukkit.getPluginManager().getPermissions());
}
-
public void updatePermissions(Player player) {
this.updatePermissions(player, null);
@@ -361,6 +360,14 @@ public class BukkitPermissions {
updatePermissions(player);
}
}
+
+ /**
+ * force Bukkit to update this Players permissions.
+ */
+ public void updatePlayer(Player player) {
+ if (player != null)
+ this.updatePermissions(player, null);
+ }
protected class PlayerEvents implements Listener {
@@ -370,7 +377,7 @@ public class BukkitPermissions {
Player player = event.getPlayer();
// force GM to create the player if they are not already listed.
if (plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getName()) != null) {
- //setPlayer_join(false);
+ setPlayer_join(false);
updatePermissions(event.getPlayer());
}
setPlayer_join(false);
@@ -378,7 +385,7 @@ public class BukkitPermissions {
@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
+ if ((event.getTo() != null) && (!event.getFrom().getWorld().equals(event.getTo().getWorld()))) { // only if world actually changed
updatePermissions(event.getPlayer(), event.getTo().getWorld().getName());
}
}
@@ -390,7 +397,7 @@ public class BukkitPermissions {
@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
+ if ((event.getTo() != null) && (!event.getFrom().getWorld().equals(event.getTo().getWorld()))) { // only if world actually changed
updatePermissions(event.getPlayer(), event.getTo().getWorld().getName());
}
}