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