Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand All @@ -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;
}
Expand Down Expand Up @@ -328,7 +328,7 @@ public void set(
final RunnableVal3<Command, Runnable, Runnable> confirm,
final RunnableVal2<Command, CommandResult> whenDone
) {
if (!checkRequirements(player)) {
if (!checkRequirements(player, Permission.PERMISSION_SET_FLAG_OTHER)) {
return;
}
if (args.length < 2) {
Expand Down Expand Up @@ -393,7 +393,7 @@ public void add(
final RunnableVal3<Command, Runnable, Runnable> confirm,
final RunnableVal2<Command, CommandResult> whenDone
) {
if (!checkRequirements(player)) {
if (!checkRequirements(player, Permission.PERMISSION_SET_FLAG_OTHER)) {
return;
}
if (args.length < 2) {
Expand Down Expand Up @@ -468,7 +468,7 @@ public void remove(
final RunnableVal3<Command, Runnable, Runnable> confirm,
final RunnableVal2<Command, CommandResult> whenDone
) {
if (!checkRequirements(player)) {
if (!checkRequirements(player, Permission.PERMISSION_SET_FLAG_OTHER)) {
return;
}
if (args.length != 1 && args.length != 2) {
Expand Down Expand Up @@ -595,7 +595,7 @@ public void list(
final RunnableVal3<Command, Runnable, Runnable> confirm,
final RunnableVal2<Command, CommandResult> whenDone
) {
if (!checkRequirements(player)) {
if (!checkRequirements(player, Permission.PERMISSION_FLAG_LIST_OTHER)) {
return;
}

Expand Down Expand Up @@ -645,7 +645,7 @@ public void info(
final RunnableVal3<Command, Runnable, Runnable> confirm,
final RunnableVal2<Command, CommandResult> whenDone
) {
if (!checkRequirements(player)) {
if (!checkRequirements(player, Permission.PERMISSION_SET_FLAG_OTHER)) {
return;
}
if (args.length < 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Loading