From 3015ba280bdd4c48b9045551b6a1aaebc08fbe07 Mon Sep 17 00:00:00 2001 From: Xefir Date: Tue, 8 May 2012 14:58:41 +0200 Subject: [PATCH] redone permissions subnodes tests ... but neither tested xD --- .../bukkit/simplyperms/SimplyCommands.java | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/net/crystalyx/bukkit/simplyperms/SimplyCommands.java b/src/net/crystalyx/bukkit/simplyperms/SimplyCommands.java index e0ddef9..23ac1fe 100755 --- a/src/net/crystalyx/bukkit/simplyperms/SimplyCommands.java +++ b/src/net/crystalyx/bukkit/simplyperms/SimplyCommands.java @@ -441,19 +441,32 @@ public class SimplyCommands implements CommandExecutor { private boolean checkPerm(CommandSender sender, String node, List subnodes) { boolean ok = sender.hasPermission("permissions." + node + ".*"); - if (!ok) { - for (String subnode : subnodes) { - String testnode = ""; - for (String sub : subnode.split(".")) { - testnode += sub; - if (sender.hasPermission("permissions." + node + "." + testnode) - || sender.hasPermission("permissions." + node + "." + testnode + ".*")) { + for (String subnode : subnodes) { + String testnode = ""; + for (String sub : subnode.split(".")) { + testnode += sub; + if (sender.isPermissionSet("permissions." + node + "." + testnode)) { + if (ok && !sender.hasPermission("permissions." + node + "." + testnode)) { + ok = false; + break; + } + else if (!ok && sender.hasPermission("permissions." + node + "." + testnode)) { + ok = true; + break; + } + } + else if (sender.isPermissionSet("permissions." + node + "." + testnode + ".*")) { + if (ok && !sender.hasPermission("permissions." + node + "." + testnode + ".*")) { + ok = false; + break; + } + else if (!ok && sender.hasPermission("permissions." + node + "." + testnode + ".*")) { ok = true; break; } } - if (ok) break; } + if (!ok) break; } if (!ok) { sender.sendMessage(ChatColor.RED + "You do not have permissions to do that.");