diff options
author | ElgarL <ElgarL@palmergames.com> | 2012-01-25 22:33:22 +0000 |
---|---|---|
committer | ElgarL <ElgarL@palmergames.com> | 2012-01-25 22:33:22 +0000 |
commit | 8a5eba9664c8ba381d66d3970d4c06be187072e1 (patch) | |
tree | 586cb0018213e6af71006d116b49ac536e0dff52 /EssentialsGroupManager | |
parent | d7bc467ee30c6f5d184965f5930bf0a0e36c6f72 (diff) | |
download | Essentials-8a5eba9664c8ba381d66d3970d4c06be187072e1.tar Essentials-8a5eba9664c8ba381d66d3970d4c06be187072e1.tar.gz Essentials-8a5eba9664c8ba381d66d3970d4c06be187072e1.tar.lz Essentials-8a5eba9664c8ba381d66d3970d4c06be187072e1.tar.xz Essentials-8a5eba9664c8ba381d66d3970d4c06be187072e1.zip |
Fixed subgroups (I broke earlier).
Diffstat (limited to 'EssentialsGroupManager')
-rw-r--r-- | EssentialsGroupManager/src/Changelog.txt | 3 | ||||
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java | 24 |
2 files changed, 17 insertions, 10 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 5307c43dc..c0746cbbd 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -118,4 +118,5 @@ v 1.9: - addSubGroup now returns a boolean for success/failure.
- '/manuaddsub' now correctly reports if it was able to add the sub group.
- Allow negation to the * permission node when populating superperms.
- - Fix trying to modify an unmodifiable collection breaking superperms.
\ No newline at end of file + - Fix trying to modify an unmodifiable collection breaking superperms.
+ - Fixed subgroups (I broke earlier).
\ 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 6e9b7ad21..7a590c412 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java @@ -152,21 +152,27 @@ public class User extends DataUnit implements Cloneable { if (this.group.equalsIgnoreCase(subGroup.getName())) { return false; } + // User already has this subgroup + if (containsSubGroup(subGroup)) + return false; + + // If the group doesn't exists add it if (!this.getDataSource().groupExists(subGroup.getName())) { getDataSource().addGroup(subGroup); - - flagAsChanged(); - if (GroupManager.isLoaded()) { - if (!GroupManager.BukkitPermissions.isPlayer_join()) - GroupManager.BukkitPermissions.updatePlayer(getBukkitPlayer()); - GroupManagerEventHandler.callEvent(this, Action.USER_SUBGROUP_CHANGED); - } - return true; } + + subGroups.add(subGroup.getName()); + flagAsChanged(); + if (GroupManager.isLoaded()) { + if (!GroupManager.BukkitPermissions.isPlayer_join()) + GroupManager.BukkitPermissions.updatePlayer(getBukkitPlayer()); + GroupManagerEventHandler.callEvent(this, Action.USER_SUBGROUP_CHANGED); + } + return true; + //subGroup = getDataSource().getGroup(subGroup.getName()); //removeSubGroup(subGroup); //subGroups.add(subGroup.getName()); - return false; } public int subGroupsSize() { |