redone permissions subnodes tests ... but neither tested xD
This commit is contained in:
parent
5a3e6c3f32
commit
3015ba280b
@ -441,19 +441,32 @@ public class SimplyCommands implements CommandExecutor {
|
||||
|
||||
private boolean checkPerm(CommandSender sender, String node, List<String> 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 + ".*")) {
|
||||
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;
|
||||
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) {
|
||||
sender.sendMessage(ChatColor.RED + "You do not have permissions to do that.");
|
||||
|
Loading…
Reference in New Issue
Block a user