From c46647d491b5d65b9ce161dce509dee85d17e0a5 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sun, 27 Jun 2021 16:40:45 +0200 Subject: [PATCH] Handle `plots.deny. properly` --- Core/src/main/java/com/plotsquared/core/command/Deny.java | 8 ++++---- .../java/com/plotsquared/core/permissions/Permission.java | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/Deny.java b/Core/src/main/java/com/plotsquared/core/command/Deny.java index 5a28bf392..a0df81a0e 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Deny.java +++ b/Core/src/main/java/com/plotsquared/core/command/Deny.java @@ -27,6 +27,7 @@ package com.plotsquared.core.command; import com.google.inject.Inject; import com.plotsquared.core.PlotSquared; +import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.location.Location; @@ -92,14 +93,13 @@ public class Deny extends SubCommand { return true; } - if (!(player.hasPermission("plots.deny." + size) || Permissions.hasPermission( - player, - Permission.PERMISSION_ADMIN_COMMAND_DENY - ))) { + int maxDenySize = Permissions.hasPermissionRange(player, Permission.PERMISSION_DENY, Settings.Limit.MAX_PLOTS); + if (size > (maxDenySize - 1)) { player.sendMessage( TranslatableCaption.of("members.plot_max_members_denied"), Template.of("amount", String.valueOf(size)) ); + return false; } PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> { 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 b288ec3b3..aa7ffdc4f 100644 --- a/Core/src/main/java/com/plotsquared/core/permissions/Permission.java +++ b/Core/src/main/java/com/plotsquared/core/permissions/Permission.java @@ -79,6 +79,7 @@ public enum Permission { PERMISSION_ADMIN_COMMAND_ADD("plots.admin.command.trust"), PERMISSION_ADMIN_COMMAND_TRUST("plots.admin.command.trust"), PERMISSION_TRUST("plots.trust"), + PERMISSION_DENY("plots.deny"), PERMISSION_ADD("plots.add"), PERMISSION_TRUST_EVERYONE("plots.trust.everyone"), PERMISSION_AREA_CREATE("plots.area.create"),