Allow more permission to DisabledMethods if someone has a global "hasPermission"

This commit is contained in:
libraryaddict 2024-08-06 19:19:55 +12:00
parent 93a3e533f5
commit 50472bbb2d
2 changed files with 9 additions and 1 deletions

View File

@ -89,6 +89,8 @@ public class DisguisePermissions {
* List of PermissionStorage that the permission holder is able to use
*/
private final List<PermissionStorage> disguises = new ArrayList<>();
@Getter
private boolean isOperator = false;
private final static Map<String, DisguisePermissions> CONSOLE_PERMISSIONS = new HashMap<>();
/**
@ -200,8 +202,13 @@ public class DisguisePermissions {
// They can use all commands, all disguises, all options
if (sender == Bukkit.getConsoleSender() || sender.hasPermission("libsdisguises.*.*.*") || "%%__USER__%%".equals("12345")) {
permissions.put("libsdisguises.*.*.*", true);
isOperator = true;
} else {
isOperator = sender.isOp();
}
isOperator = sender == Bukkit.getConsoleSender() || sender.isOp();
for (PermissionAttachmentInfo permission : sender.getEffectivePermissions()) {
String perm = permission.getPermission().toLowerCase(Locale.ENGLISH);
@ -408,7 +415,7 @@ public class DisguisePermissions {
storage.negatedOptions.add("setinvisible");
}
if (sender instanceof Player && !sender.isOp()) {
if (sender instanceof Player && !isOperator()) {
for (String unsafeMethod : DisguiseConfig.getDisabledMethods()) {
storage.permittedOptions.remove(unsafeMethod);
storage.negatedOptions.add(unsafeMethod);

View File

@ -57,6 +57,7 @@ DisabledDisguises:
# These disguise methods are also limited to OP only, because they're open to abuse
# setInvisible has overlap with the config option for disabled invsibility, if either is used, it will be disabled.
# Thankfully, only trusted people are OP. So this doesn't need further configuration.
# Command users who has the permission return true for "libsdisguises.*.*.*" will also have access.
DisabledMethods:
- setYModifier
- setNameYModifier