mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-03-02 11:12:28 +01:00
Made User#hasPermission(String) return true if the user is op
This commit is contained in:
parent
1e20ccb604
commit
2bec47ba90
@ -93,7 +93,7 @@ public class DefaultHelpCommand extends CompositeCommand {
|
||||
// Show the help
|
||||
if (user.isPlayer()) {
|
||||
// Player. Check perms
|
||||
if (user.isOp() || user.hasPermission(parent.getPermission())) {
|
||||
if (user.hasPermission(parent.getPermission())) {
|
||||
if (params == null || params.isEmpty()) {
|
||||
user.sendMessage(HELP_SYNTAX_NO_PARAMETERS_REF, USAGE_PLACEHOLDER, usage, DESC_PLACEHOLDER, desc);
|
||||
} else {
|
||||
|
@ -54,7 +54,7 @@ public class IslandCreateCommand extends CompositeCommand {
|
||||
name = args.get(0).toLowerCase(java.util.Locale.ENGLISH);
|
||||
// Permission check
|
||||
String permission = this.getPermissionPrefix() + "island.create." + name;
|
||||
if (!user.isOp() && !user.hasPermission(permission)) {
|
||||
if (!user.hasPermission(permission)) {
|
||||
user.sendMessage("general.errors.no-permission", TextVariables.PERMISSION, permission);
|
||||
return false;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class IslandResetCommand extends ConfirmableCommand {
|
||||
|
||||
// Permission check if the name is not the default one
|
||||
String permission = getPermissionPrefix() + "island.create." + name;
|
||||
if (!name.equals(SchemsManager.DEFAULT_SCHEM_NAME) && !user.isOp() && !user.hasPermission(permission)) {
|
||||
if (!name.equals(SchemsManager.DEFAULT_SCHEM_NAME) && !user.hasPermission(permission)) {
|
||||
user.sendMessage("general.errors.no-permission", TextVariables.PERMISSION, permission);
|
||||
return false;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class IslandSetnameCommand extends CompositeCommand {
|
||||
}
|
||||
|
||||
// Set the name
|
||||
if (user.isOp() || user.hasPermission(this.getPermissionPrefix() + ".island.name.format")) {
|
||||
if (user.hasPermission(this.getPermissionPrefix() + ".island.name.format")) {
|
||||
getIslands().getIsland(getWorld(), playerUUID).setName(ChatColor.translateAlternateColorCodes('&', name));
|
||||
} else {
|
||||
getIslands().getIsland(getWorld(), playerUUID).setName(name);
|
||||
|
@ -182,7 +182,7 @@ public abstract class FlagListener implements Listener {
|
||||
}
|
||||
|
||||
// Ops or "bypass everywhere" moderators can do anything
|
||||
if (user.isOp() || user.hasPermission(getIWM().getPermissionPrefix(loc.getWorld()) + ".mod.bypass." + flag.getID() + ".everywhere")) {
|
||||
if (user.hasPermission(getIWM().getPermissionPrefix(loc.getWorld()) + ".mod.bypass." + flag.getID() + ".everywhere")) {
|
||||
if (user.isOp()) {
|
||||
report(user, e, loc, flag, Why.OP);
|
||||
} else {
|
||||
|
@ -174,10 +174,10 @@ public class User {
|
||||
|
||||
/**
|
||||
* @param permission permission string
|
||||
* @return true if permission is empty or if the player has that permission.
|
||||
* @return true if permission is empty or if the player has that permission or if the player is op.
|
||||
*/
|
||||
public boolean hasPermission(String permission) {
|
||||
return permission.isEmpty() || sender.hasPermission(permission);
|
||||
return permission.isEmpty() || isOp() || sender.hasPermission(permission);
|
||||
}
|
||||
|
||||
public boolean isOnline() {
|
||||
|
Loading…
Reference in New Issue
Block a user