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) {
|
private boolean checkPerm(CommandSender sender, String node, List<String> subnodes) {
|
||||||
boolean ok = sender.hasPermission("permissions." + node + ".*");
|
boolean ok = sender.hasPermission("permissions." + node + ".*");
|
||||||
if (!ok) {
|
for (String subnode : subnodes) {
|
||||||
for (String subnode : subnodes) {
|
String testnode = "";
|
||||||
String testnode = "";
|
for (String sub : subnode.split(".")) {
|
||||||
for (String sub : subnode.split(".")) {
|
testnode += sub;
|
||||||
testnode += sub;
|
if (sender.isPermissionSet("permissions." + node + "." + testnode)) {
|
||||||
if (sender.hasPermission("permissions." + node + "." + testnode)
|
if (ok && !sender.hasPermission("permissions." + node + "." + testnode)) {
|
||||||
|| 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;
|
ok = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ok) break;
|
|
||||||
}
|
}
|
||||||
|
if (!ok) break;
|
||||||
}
|
}
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
sender.sendMessage(ChatColor.RED + "You do not have permissions to do that.");
|
sender.sendMessage(ChatColor.RED + "You do not have permissions to do that.");
|
||||||
|
Loading…
Reference in New Issue
Block a user