diff options
author | ElgarL <ElgarL@palmergames.com> | 2011-11-04 18:20:09 +0000 |
---|---|---|
committer | ElgarL <ElgarL@palmergames.com> | 2011-11-04 18:20:09 +0000 |
commit | e7234e621dc9c6dfb09011eb9ef5338d8824368f (patch) | |
tree | b696a3d0c2d10caf4582d2c1fc8899a9aedc4b96 /EssentialsGroupManager | |
parent | 269947bdae7b0f0ad8bdef701f47e379c5be3c27 (diff) | |
download | Essentials-e7234e621dc9c6dfb09011eb9ef5338d8824368f.tar Essentials-e7234e621dc9c6dfb09011eb9ef5338d8824368f.tar.gz Essentials-e7234e621dc9c6dfb09011eb9ef5338d8824368f.tar.lz Essentials-e7234e621dc9c6dfb09011eb9ef5338d8824368f.tar.xz Essentials-e7234e621dc9c6dfb09011eb9ef5338d8824368f.zip |
Optimize notify test so it's not run as often
Diffstat (limited to 'EssentialsGroupManager')
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java index ee1623bed..8cfb3d14a 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java @@ -117,16 +117,18 @@ public class User extends DataUnit implements Cloneable { getDataSource().addGroup(group); } group = getDataSource().getGroup(group.getName()); - // Do we notify of the group change? - String defaultGroupName = getDataSource().getDefaultGroup().getName(); - // if we are not in the default group - // or we are in the default group and the move is to a different group. - boolean notify = (!this.group.equalsIgnoreCase(defaultGroupName)) || ((this.group.equalsIgnoreCase(defaultGroupName)) && (!group.getName().equalsIgnoreCase(defaultGroupName))) ; + String oldGroup = this.group; this.group = group.getName(); flagAsChanged(); if (GroupManager.isLoaded()) { if (GroupManager.BukkitPermissions.player_join = false) GroupManager.BukkitPermissions.updateAllPlayers(); + + // Do we notify of the group change? + String defaultGroupName = getDataSource().getDefaultGroup().getName(); + // if we were not in the default group + // or we were in the default group and the move is to a different group. + boolean notify = (!oldGroup.equalsIgnoreCase(defaultGroupName)) || ((oldGroup.equalsIgnoreCase(defaultGroupName)) && (!this.group.equalsIgnoreCase(defaultGroupName))) ; if (notify) GroupManager.notify(this.getName(), String.format(" moved to the group %s.", group.getName())); } |