mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-16 07:14:04 +00:00
This commit is contained in:
@@ -324,7 +324,9 @@ public class SchematicCommands {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean other = false;
|
||||
if (filename.contains("../")) {
|
||||
other = true;
|
||||
if (!player.hasPermission("worldedit.schematic.save.other")) {
|
||||
BBC.NO_PERM.send(player, "worldedit.schematic.save.other");
|
||||
return;
|
||||
@@ -342,6 +344,12 @@ public class SchematicCommands {
|
||||
if (!player.hasPermission("worldedit.schematic.delete")) {
|
||||
throw new StopExecutionException(TextComponent.of("That schematic already exists!"));
|
||||
}
|
||||
if (other) {
|
||||
if (!player.hasPermission("worldedit.schematic.delete.other")) {
|
||||
BBC.NO_PERM.send(player, "worldedit.schematic.delete.other");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!allowOverwrite) {
|
||||
player.printError("That schematic already exists. Use the -f flag to overwrite it.");
|
||||
return;
|
||||
@@ -373,9 +381,8 @@ public class SchematicCommands {
|
||||
BBC.SCHEMATIC_MOVE_EXISTS.send(player, f.getName());
|
||||
}
|
||||
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
|
||||
try (FileOutputStream fos = new FileOutputStream(f)) {
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
Clipboard clipboard = holder.getClipboard();
|
||||
Transform transform = holder.getTransform();
|
||||
Clipboard target;
|
||||
@@ -502,7 +509,7 @@ public class SchematicCommands {
|
||||
BBC.NO_PERM.send(actor, "worldedit.schematic.delete.other");
|
||||
continue;
|
||||
}
|
||||
if (!f.delete()) {
|
||||
if (!delete(f)) {
|
||||
actor.printError("Deletion of " + filename + " failed! Maybe it is read-only.");
|
||||
continue;
|
||||
}
|
||||
@@ -814,4 +821,12 @@ public class SchematicCommands {
|
||||
}
|
||||
return fileList;
|
||||
}
|
||||
|
||||
private boolean delete(File file) {
|
||||
if (file.delete()) {
|
||||
new File(file.getParentFile(), "." + file.getName() + ".cached").delete();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user