Skip to content

Commit

Permalink
Default to op when no permissions are set
Browse files Browse the repository at this point in the history
  • Loading branch information
pop4959 committed Feb 17, 2024
1 parent 7b5594c commit 7381378
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fabric/src/main/java/org/popcraft/chunky/ChunkyFabric.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 7381378

Please sign in to comment.