diff options
author | ElgarL <ElgarL@palmergames.com> | 2012-01-22 23:46:26 +0000 |
---|---|---|
committer | ElgarL <ElgarL@palmergames.com> | 2012-01-22 23:46:26 +0000 |
commit | 6237e2e51fefb7e4f8603770387e300993313542 (patch) | |
tree | 874ed4cde9635079fc5ab2d3b27f85a7e9acbbbf /EssentialsGroupManager | |
parent | 8d5224444cc7bc9a6b9541a13f13b5a5ce39b444 (diff) | |
download | Essentials-6237e2e51fefb7e4f8603770387e300993313542.tar Essentials-6237e2e51fefb7e4f8603770387e300993313542.tar.gz Essentials-6237e2e51fefb7e4f8603770387e300993313542.tar.lz Essentials-6237e2e51fefb7e4f8603770387e300993313542.tar.xz Essentials-6237e2e51fefb7e4f8603770387e300993313542.zip |
Fixed infinite loop error on player join.
Optimized code to only update the player logging in instead of all
players online.
Diffstat (limited to 'EssentialsGroupManager')
3 files changed, 18 insertions, 9 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 6fc20d0b5..b58f520a8 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -109,4 +109,6 @@ v 1.9: - 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.
- - Fixed a random null error upon a player portaling.
\ No newline at end of file + - 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/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/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java index e4bb94592..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);
|