Disable destructive operations for plot world plots

This commit is contained in:
N0tMyFaultOG 2021-01-08 16:06:15 +01:00
parent cc90127af9
commit f13f7ce129
No known key found for this signature in database
GPG Key ID: 823348042DA95A81
4 changed files with 14 additions and 0 deletions

View File

@ -137,6 +137,8 @@ public final class Backup extends Command {
TranslatableCaption.of("backup_impossible"),
Template.of("plot", "generic.generic_unowned")
);
} else if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
} else if (plot.isMerged()) {
player.sendMessage(
TranslatableCaption.of("backup_impossible"),

View File

@ -65,6 +65,10 @@ public class Biome extends SetCommand {
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
return false;
}
if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
return false;
}
plot.addRunning();
plot.getPlotModificationManager().setBiome(biome, () -> {
plot.removeRunning();

View File

@ -82,6 +82,10 @@ public class Clear extends Command {
Template.of("value", "Clear"));
return CompletableFuture.completedFuture(true);
}
if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
return CompletableFuture.completedFuture(true);
}
boolean force = eventResult == Result.FORCE;
checkTrue(force || plot.isOwner(player.getUUID()) || Permissions
.hasPermission(player, "plots.admin.command.clear"),

View File

@ -74,6 +74,10 @@ public class Delete extends SubCommand {
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
return false;
}
if (plot.getVolume() > Integer.MAX_VALUE) {
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
return false;
}
Result eventResult = this.eventDispatcher.callDelete(plot).getEventResult();
if (eventResult == Result.DENY) {
player.sendMessage(