diff options
author | ElgarL <ElgarL@palmergames.com> | 2012-01-29 10:54:24 +0000 |
---|---|---|
committer | ElgarL <ElgarL@palmergames.com> | 2012-01-29 10:54:24 +0000 |
commit | 95885e46c9f207a0c06f595fef0dbc56c7f5b59c (patch) | |
tree | 3ff22f6605fe211fb23ccd19ecf6b788cbaa57dd /EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions | |
parent | 3deff2afe7b225337bd03d23022c4f4e9df8c0c9 (diff) | |
download | Essentials-95885e46c9f207a0c06f595fef0dbc56c7f5b59c.tar Essentials-95885e46c9f207a0c06f595fef0dbc56c7f5b59c.tar.gz Essentials-95885e46c9f207a0c06f595fef0dbc56c7f5b59c.tar.lz Essentials-95885e46c9f207a0c06f595fef0dbc56c7f5b59c.tar.xz Essentials-95885e46c9f207a0c06f595fef0dbc56c7f5b59c.zip |
Fix players retaining permissions when demoted.
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions')
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java index 396b49583..d1193510e 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java @@ -28,7 +28,6 @@ import java.util.Map; import java.util.Set;
import org.anjocaido.groupmanager.GroupManager;
-import org.anjocaido.groupmanager.dataholder.OverloadedWorldHolder;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@@ -136,33 +135,30 @@ public class BukkitPermissions { }
PermissionAttachment attachment;
+
// Find the players current attachment, or add a new one.
if (this.attachments.containsKey(player)) {
attachment = this.attachments.get(player);
} else {
attachment = player.addAttachment(plugin);
- this.attachments.put(player, attachment);;
+ this.attachments.put(player, attachment);
}
if (world == null) {
world = player.getWorld().getName();
}
- OverloadedWorldHolder worldData = plugin.getWorldsHolder().getWorldData(world);
- Boolean value = false;
-
// Add all permissions for this player (GM only)
// child nodes will be calculated by Bukkit.
- List<String> playerPermArray = new ArrayList<String>(worldData.getPermissionsHandler().getAllPlayersPermissions(player.getName(), false));
+ List<String> playerPermArray = new ArrayList<String>(plugin.getWorldsHolder().getWorldData(world).getPermissionsHandler().getAllPlayersPermissions(player.getName(), false));
LinkedHashMap<String, Boolean> newPerms = new LinkedHashMap<String, Boolean>();
// Sort the perm list by parent/child, so it will push to superperms correctly.
playerPermArray = sort(playerPermArray);
-
+ Boolean value = false;
for (String permission : playerPermArray) {
value = (!permission.startsWith("-"));
-
newPerms.put((value? permission : permission.substring(1)), value);
}
@@ -178,7 +174,8 @@ public class BukkitPermissions { // Then whack our map into there
orig.putAll(newPerms);
// That's all folks!
- attachment.getPermissible().recalculatePermissions();
+ //attachment.getPermissible().recalculatePermissions();
+ player.recalculatePermissions();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
|