mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Restrict a few more commands from plot world plots
And add missing tab completion for debug commands
This commit is contained in:
parent
38b60205e8
commit
3833d2cd83
@ -203,6 +203,8 @@ public final class Backup extends Command {
|
||||
TranslatableCaption.of("backup_impossible"),
|
||||
Template.of("plot", "generic.generic_merged")
|
||||
);
|
||||
} else if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
} else if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
||||
player.sendMessage(
|
||||
@ -272,10 +274,8 @@ public final class Backup extends Command {
|
||||
TranslatableCaption.of("backup_impossible"),
|
||||
Template.of("plot", "generic.generic_merged")
|
||||
);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backup_impossible"),
|
||||
Template.of("plot", "generic.generic_merged")
|
||||
);
|
||||
} else if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
} else if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_BACKUP_OTHER)) {
|
||||
player.sendMessage(
|
||||
|
@ -58,6 +58,10 @@ public class CreateRoadSchematic extends SubCommand {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
return false;
|
||||
}
|
||||
if (!(location.getPlotArea() instanceof HybridPlotWorld)) {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot_world"));
|
||||
}
|
||||
|
@ -50,8 +50,11 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@CommandDeclaration(command = "debug",
|
||||
category = CommandCategory.DEBUG,
|
||||
@ -195,4 +198,12 @@ public class Debug extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Command> tab(final PlotPlayer<?> player, String[] args, boolean space) {
|
||||
return Stream.of("loadedchunks", "debug-players", "logging", "entitytypes", "msg")
|
||||
.filter(value -> value.startsWith(args[0].toLowerCase(Locale.ENGLISH)))
|
||||
.map(value -> new Command(null, false, value, "plots.admin", RequiredType.NONE, null) {
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -58,6 +58,8 @@ public class DebugRoadRegen extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
||||
Location location = player.getLocation();
|
||||
Plot plot = location.getPlotAbs();
|
||||
if (args.length < 1) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
@ -65,6 +67,11 @@ public class DebugRoadRegen extends SubCommand {
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
return false;
|
||||
}
|
||||
String kind = args[0].toLowerCase();
|
||||
switch (kind) {
|
||||
case "plot":
|
||||
|
@ -105,6 +105,10 @@ public class Merge 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;
|
||||
}
|
||||
Direction direction = null;
|
||||
if (args.length == 0) {
|
||||
switch (direction(player.getLocationFull().getYaw())) {
|
||||
|
@ -79,6 +79,10 @@ public class Save 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;
|
||||
}
|
||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_SAVE)) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
|
@ -116,6 +116,10 @@ public class SchematicCmd extends SubCommand {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
return false;
|
||||
}
|
||||
if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
return false;
|
||||
}
|
||||
if (this.running) {
|
||||
player.sendMessage(TranslatableCaption.of("error.task_in_process"));
|
||||
return false;
|
||||
@ -179,6 +183,8 @@ public class SchematicCmd extends SubCommand {
|
||||
}
|
||||
case "saveall":
|
||||
case "exportall": {
|
||||
Location loc = player.getLocation();
|
||||
final Plot plot = loc.getPlotAbs();
|
||||
if (!(player instanceof ConsolePlayer)) {
|
||||
player.sendMessage(TranslatableCaption.of("console.not_console"));
|
||||
return false;
|
||||
@ -191,6 +197,10 @@ public class SchematicCmd extends SubCommand {
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
return false;
|
||||
}
|
||||
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[1]);
|
||||
if (area == null) {
|
||||
player.sendMessage(
|
||||
@ -246,6 +256,10 @@ public class SchematicCmd 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;
|
||||
}
|
||||
if (!plot.isOwner(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, "plots.admin.command.schematic.save")) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
|
@ -230,6 +230,10 @@ public class Set extends SubCommand {
|
||||
player.sendMessage(TranslatableCaption.of("errors.not_in_plot"));
|
||||
return false;
|
||||
}
|
||||
if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
return false;
|
||||
}
|
||||
// components
|
||||
HashSet<String> components =
|
||||
new HashSet<>(Arrays.asList(plot.getManager().getPlotComponents(plot.getId())));
|
||||
|
@ -67,6 +67,10 @@ public class Unlink 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;
|
||||
}
|
||||
if (!plot.isMerged()) {
|
||||
player.sendMessage(TranslatableCaption.of("merge.unlink_impossible"));
|
||||
}
|
||||
|
@ -162,6 +162,9 @@ public class ComponentPresetManager {
|
||||
} else if (!plot.isOwner(player.getUUID()) && !plot.getTrusted().contains(player.getUUID())) {
|
||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||
return null;
|
||||
} else if (plot.getVolume() > Integer.MAX_VALUE) {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.schematic_too_large"));
|
||||
return null;
|
||||
}
|
||||
|
||||
final List<ComponentPreset> allowedPresets = new ArrayList<>(this.presets.size());
|
||||
|
@ -8,7 +8,7 @@
|
||||
"move.requires_unowned": "<prefix><red>The location specified is already occupied.</red>",
|
||||
"debug.requires_unmerged": "<prefix><red>The plot cannot be merged.</red>",
|
||||
"debug.debug_header": "<prefix> <gold>Debug Information</gold>\n",
|
||||
"debug.debug_section": "<gray>>></gray> <gold><bold>&l<val></bold></gold>",
|
||||
"debug.debug_section": "<gray>>></gray> <gold><bold><val></bold></gold>",
|
||||
"debug.debug_line": "<gray>>></gray> <gold><var></gold><gray>:</gray><gold> <val></gold>\n",
|
||||
"debug.plot_debug": "<gray>[<gold>Plot </gold><gray>Debug] (</gray><gold><plot></gold><gray>): <message></gray>",
|
||||
"debug.fetching_loaded_chunks": "<prefix><gold>Fetching loaded chunks...</gold>",
|
||||
|
Loading…
Reference in New Issue
Block a user