diff --git a/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java b/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java index 4406bf1765..11f4ca7be6 100644 --- a/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/FlagCommand.java @@ -177,7 +177,7 @@ private static boolean checkPermValue( * * @return {@code true} if the player is allowed to modify the flags at their current location */ - private static boolean checkRequirements(final @NonNull PlotPlayer player) { + private static boolean checkRequirements(final @NonNull PlotPlayer player, final @NonNull Permission permission) { final Plot plot = player.getCurrentPlot(); if (plot == null) { player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); @@ -187,10 +187,10 @@ private static boolean checkRequirements(final @NonNull PlotPlayer player) { player.sendMessage(TranslatableCaption.of("working.plot_not_claimed")); return false; } - if (!plot.isOwner(player.getUUID()) && !player.hasPermission(Permission.PERMISSION_SET_FLAG_OTHER)) { + if (!plot.isOwner(player.getUUID()) && !player.hasPermission(permission)) { player.sendMessage( TranslatableCaption.of("permission.no_permission"), - TagResolver.resolver("node", Tag.inserting(Permission.PERMISSION_SET_FLAG_OTHER)) + TagResolver.resolver("node", Tag.inserting(permission)) ); return false; } @@ -328,7 +328,7 @@ public void set( final RunnableVal3 confirm, final RunnableVal2 whenDone ) { - if (!checkRequirements(player)) { + if (!checkRequirements(player, Permission.PERMISSION_SET_FLAG_OTHER)) { return; } if (args.length < 2) { @@ -393,7 +393,7 @@ public void add( final RunnableVal3 confirm, final RunnableVal2 whenDone ) { - if (!checkRequirements(player)) { + if (!checkRequirements(player, Permission.PERMISSION_SET_FLAG_OTHER)) { return; } if (args.length < 2) { @@ -468,7 +468,7 @@ public void remove( final RunnableVal3 confirm, final RunnableVal2 whenDone ) { - if (!checkRequirements(player)) { + if (!checkRequirements(player, Permission.PERMISSION_SET_FLAG_OTHER)) { return; } if (args.length != 1 && args.length != 2) { @@ -595,7 +595,7 @@ public void list( final RunnableVal3 confirm, final RunnableVal2 whenDone ) { - if (!checkRequirements(player)) { + if (!checkRequirements(player, Permission.PERMISSION_FLAG_LIST_OTHER)) { return; } @@ -645,7 +645,7 @@ public void info( final RunnableVal3 confirm, final RunnableVal2 whenDone ) { - if (!checkRequirements(player)) { + if (!checkRequirements(player, Permission.PERMISSION_SET_FLAG_OTHER)) { return; } if (args.length < 1) { diff --git a/Core/src/main/java/com/plotsquared/core/permissions/Permission.java b/Core/src/main/java/com/plotsquared/core/permissions/Permission.java index 4afbda3d3d..1828e1de91 100644 --- a/Core/src/main/java/com/plotsquared/core/permissions/Permission.java +++ b/Core/src/main/java/com/plotsquared/core/permissions/Permission.java @@ -145,6 +145,7 @@ public enum Permission implements ComponentLike { PERMISSION_FLAG_REMOVE("plots.flag.remove"), PERMISSION_FLAG_ADD("plots.flag.add"), PERMISSION_FLAG_LIST("plots.flag.list"), + PERMISSION_FLAG_LIST_OTHER("plots.flag.list.other"), PERMISSION_ADMIN_COMMAND_KICK("plots.admin.command.kick"), PERMISSION_GRANT_SINGLE("plots.grant"), PERMISSION_GRANT("plots.grant.%s"),