update has_perm check, update setup cmd
Some checks failed
/ Auto-Build-App (push) Has been cancelled

This commit is contained in:
pietru 2024-12-28 23:33:12 +01:00
parent 36d04bc041
commit cffa6d199e
2 changed files with 9 additions and 8 deletions

View file

@ -105,18 +105,22 @@ public class TextCommands {
commands.put("setup",(args, networkIdentity, channelHandlerContext) -> { commands.put("setup",(args, networkIdentity, channelHandlerContext) -> {
Account account = ServerSingletons.getAccount(networkIdentity); Account account = ServerSingletons.getAccount(networkIdentity);
boolean cancel = false; boolean cancel = false;
boolean setup_perm_check = false;
boolean started = false; boolean started = false;
if (args.length==2) { if (args.length==2) {
boolean a = has_perm(account.getUniqueId(), Setup.get_perm(args[1])); boolean a = has_perm(account.getUniqueId(), Setup.get_perm(args[1]));
boolean b = has_perm(account.getUniqueId(), "setup.*");
if (args[1].equalsIgnoreCase("cancel")) if (args[1].equalsIgnoreCase("cancel"))
cancel = Setup.cancel(account.getUniqueId()); cancel = Setup.cancel(account.getUniqueId());
else if (a || b) else if (a)
started = Setup.start(account.getUniqueId(), args[1]); started = Setup.start(account.getUniqueId(), args[1]);
} }
MessagePacket packet = new MessagePacket((started || cancel) ? (cancel ? "[Server] Setup canceled.." : "[Server] Starting setup..") : "[Server] Failed to start setup... (There might be one running)"); MessagePacket packet = new MessagePacket(
(started || cancel)
?
(cancel ? "[Server] Setup canceled.." : "[Server] Starting setup..") :
(setup_perm_check ? "[Server] Failed to start setup... (There might be one running)" : "[Server] No setup perm..."));
packet.setupAndSend(channelHandlerContext); packet.setupAndSend(channelHandlerContext);
if (started){ if (started){

View file

@ -123,9 +123,6 @@ public class Permissions {
if (j < i) if (j < i)
perm_test.append(perm_parts[j]).append("."); perm_test.append(perm_parts[j]).append(".");
else { else {
if (perm_parts.length == i + 1)
perm_test.append(perm_parts[j]);
else
perm_test.append("*"); perm_test.append("*");
} }
} }
@ -135,7 +132,7 @@ public class Permissions {
} }
} }
} }
return has_user_special_perm(playerId) || has_valid_perm; return has_user_special_perm(playerId) || has_valid_perm || group.has_perm(perm);
} }
public static GroupPerms get_group(String playerId){ public static GroupPerms get_group(String playerId){