From d2bc7e01a251c21ff4b9de7193e8a6187d7ffd37 Mon Sep 17 00:00:00 2001 From: snowleo Date: Mon, 18 Jul 2011 13:18:28 +0200 Subject: [PATCH] Workaround for the crippled bukkit permissions. Splits the node at . and checks for * permissions on all levels. --- .../essentials/BukkitPermissionsHandler.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/BukkitPermissionsHandler.java b/Essentials/src/com/earth2me/essentials/BukkitPermissionsHandler.java index a352bcb5a..aee9ef0b4 100644 --- a/Essentials/src/com/earth2me/essentials/BukkitPermissionsHandler.java +++ b/Essentials/src/com/earth2me/essentials/BukkitPermissionsHandler.java @@ -5,7 +5,6 @@ import org.bukkit.entity.Player; public class BukkitPermissionsHandler implements IPermissionsHandler { - public String getGroup(Player base) { return "default"; @@ -23,6 +22,20 @@ public class BukkitPermissionsHandler implements IPermissionsHandler public boolean hasPermission(Player base, String node) { + if (base.hasPermission("-" + node)) + { + return false; + } + final String[] parts = node.split("\\."); + final StringBuilder sb = new StringBuilder(); + for (String part : parts) + { + if (base.hasPermission(sb.toString() + "*")) + { + return true; + } + sb.append(part).append("."); + } return base.hasPermission(node); } @@ -35,5 +48,4 @@ public class BukkitPermissionsHandler implements IPermissionsHandler { return ""; } - }