From 73813786c0887bcb679a0c0d3ccdc68ddce0525b Mon Sep 17 00:00:00 2001 From: Christopher Bohn Date: Fri, 16 Feb 2024 18:11:33 -0800 Subject: [PATCH] Default to op when no permissions are set --- .../main/java/org/popcraft/chunky/ChunkyFabric.java | 2 +- .../org/popcraft/chunky/platform/FabricSender.java | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/fabric/src/main/java/org/popcraft/chunky/ChunkyFabric.java b/fabric/src/main/java/org/popcraft/chunky/ChunkyFabric.java index bd78df6a..4233bf6c 100644 --- a/fabric/src/main/java/org/popcraft/chunky/ChunkyFabric.java +++ b/fabric/src/main/java/org/popcraft/chunky/ChunkyFabric.java @@ -66,7 +66,7 @@ public void onInitialize() { if (serverCommandSource.getServer().isSingleplayer()) { return true; } - return new FabricSender(serverCommandSource).hasPermission("chunky.command"); + return new FabricSender(serverCommandSource).hasPermission("chunky.command", true); }) .executes(context -> { final Sender sender; diff --git a/fabric/src/main/java/org/popcraft/chunky/platform/FabricSender.java b/fabric/src/main/java/org/popcraft/chunky/platform/FabricSender.java index 186090d2..19eee357 100644 --- a/fabric/src/main/java/org/popcraft/chunky/platform/FabricSender.java +++ b/fabric/src/main/java/org/popcraft/chunky/platform/FabricSender.java @@ -54,8 +54,16 @@ public Location getLocation() { @Override public boolean hasPermission(final String permission) { + return hasPermission(permission, false); + } + + public boolean hasPermission(final String permission, final boolean defaultOp) { if (HAS_PERMISSIONS) { - return Permissions.check(source, permission, false); + if (defaultOp) { + return Permissions.check(source, permission, 2); + } else { + return Permissions.check(source, permission, false); + } } else { return source.hasPermissionLevel(2); }