diff options
author | ElgarL <ElgarL@palmergames.com> | 2011-09-19 22:51:07 +0100 |
---|---|---|
committer | ElgarL <ElgarL@palmergames.com> | 2011-09-19 22:51:07 +0100 |
commit | d3f6e82474c2c67a3fb17a7b08a8a94b8eb7ae60 (patch) | |
tree | 34d3f92d30565e88986ef12efb99a14091f454fa /EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions | |
parent | 8d266a34400d3eee173470e873b2385564c96f7a (diff) | |
download | Essentials-d3f6e82474c2c67a3fb17a7b08a8a94b8eb7ae60.tar Essentials-d3f6e82474c2c67a3fb17a7b08a8a94b8eb7ae60.tar.gz Essentials-d3f6e82474c2c67a3fb17a7b08a8a94b8eb7ae60.tar.lz Essentials-d3f6e82474c2c67a3fb17a7b08a8a94b8eb7ae60.tar.xz Essentials-d3f6e82474c2c67a3fb17a7b08a8a94b8eb7ae60.zip |
- Push updates to superperms for all valid GM commands.
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions')
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java index fe381c127..c88f48d6c 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java @@ -18,12 +18,13 @@ package org.anjocaido.groupmanager.permissions; import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Set;
import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.data.User;
+import org.anjocaido.groupmanager.dataholder.OverloadedWorldHolder;
+import org.anjocaido.groupmanager.utils.PermissionCheckResult;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@@ -40,6 +41,7 @@ import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.event.server.ServerListener;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
+import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
@@ -114,9 +116,10 @@ public class BukkitPermissions { }
PermissionAttachment attachment = this.attachments.get(player);
+
+ OverloadedWorldHolder worldData = GroupManager.getWorldsHolder().getWorldData(world);
- User user = GroupManager.getWorldsHolder().getWorldData(world).getUser(player.getName());
- List<String> permissions = user.getGroup().getPermissionList();
+ User user = worldData.getUser(player.getName());
// clear permissions
for (String permission : attachment.getPermissions().keySet()) {
@@ -125,24 +128,19 @@ public class BukkitPermissions { // find matching permissions
for (Permission permission : registeredPermissions) {
- boolean permissionValue = user.getGroup().hasSamePermissionNode(permission.getName());
- attachment.setPermission(permission, permissionValue);
- }
-
- // all permissions
- for (String permission : permissions) {
- Boolean value = true;
- if (permission.startsWith("-")) {
- permission = permission.substring(1); // cut off -
+ PermissionCheckResult permissionResult = worldData.getPermissionsHandler().checkFullUserPermission(user, permission.getName());
+ Boolean value = false;
+ if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) {
value = false;
- }
-
- if (!attachment.getPermissions().containsKey(permission)) {
- attachment.setPermission(permission, value);
- }
- }
+ } else if (permissionResult.resultType.equals(PermissionCheckResult.Type.FOUND))
+ value = true;
+
+
+ attachment.setPermission(permission, value);
+ }
player.recalculatePermissions();
+
/*
// List perms for this player
GroupManager.logger.info("Attachment Permissions:");
|