Handle plots.deny.<amount> properly

This commit is contained in:
NotMyFault 2021-06-27 16:40:45 +02:00
parent 013e8fcda5
commit c46647d491
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
2 changed files with 5 additions and 4 deletions

View File

@ -27,6 +27,7 @@ package com.plotsquared.core.command;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
@ -92,14 +93,13 @@ public class Deny extends SubCommand {
return true; return true;
} }
if (!(player.hasPermission("plots.deny." + size) || Permissions.hasPermission( int maxDenySize = Permissions.hasPermissionRange(player, Permission.PERMISSION_DENY, Settings.Limit.MAX_PLOTS);
player, if (size > (maxDenySize - 1)) {
Permission.PERMISSION_ADMIN_COMMAND_DENY
))) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("members.plot_max_members_denied"), TranslatableCaption.of("members.plot_max_members_denied"),
Template.of("amount", String.valueOf(size)) Template.of("amount", String.valueOf(size))
); );
return false;
} }
PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> { PlayerManager.getUUIDsFromString(args[0], (uuids, throwable) -> {

View File

@ -79,6 +79,7 @@ public enum Permission {
PERMISSION_ADMIN_COMMAND_ADD("plots.admin.command.trust"), PERMISSION_ADMIN_COMMAND_ADD("plots.admin.command.trust"),
PERMISSION_ADMIN_COMMAND_TRUST("plots.admin.command.trust"), PERMISSION_ADMIN_COMMAND_TRUST("plots.admin.command.trust"),
PERMISSION_TRUST("plots.trust"), PERMISSION_TRUST("plots.trust"),
PERMISSION_DENY("plots.deny"),
PERMISSION_ADD("plots.add"), PERMISSION_ADD("plots.add"),
PERMISSION_TRUST_EVERYONE("plots.trust.everyone"), PERMISSION_TRUST_EVERYONE("plots.trust.everyone"),
PERMISSION_AREA_CREATE("plots.area.create"), PERMISSION_AREA_CREATE("plots.area.create"),