Plot location may be final

This commit is contained in:
NotMyFault 2021-09-09 12:36:09 +02:00
parent c25a0c65a2
commit 27a8fcd739
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C

View File

@ -51,7 +51,7 @@ import java.util.concurrent.TimeoutException;
@CommandDeclaration(command = "deny",
aliases = {"d", "ban"},
usage = "/plot deny <player | *>",
usage = "/plot deny <player",
category = CommandCategory.SETTINGS,
requiredType = RequiredType.PLAYER)
public class Deny extends SubCommand {
@ -76,9 +76,7 @@ public class Deny extends SubCommand {
public boolean onCommand(PlotPlayer<?> player, String[] args) {
Location location = player.getLocation();
Plot plot = location.getPlotAbs();
final Plot currentPlot = player.getCurrentPlot();
int size = currentPlot.getDenied().size();
final Plot plot = location.getPlotAbs();
if (plot == null) {
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
return false;
@ -94,6 +92,7 @@ public class Deny extends SubCommand {
}
int maxDenySize = Permissions.hasPermissionRange(player, Permission.PERMISSION_DENY, Settings.Limit.MAX_PLOTS);
int size = plot.getDenied().size();
if (size > (maxDenySize - 1)) {
player.sendMessage(
TranslatableCaption.of("members.plot_max_members_denied"),