3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-09-07 00:22:51 +02:00

Don't double-check for symlinks while loading schematics.

Fixes WORLDEDIT-3310.
Dieser Commit ist enthalten in:
wizjany 2015-06-19 18:27:20 -04:00
Ursprung b4d574273d
Commit 025591e6d9

Datei anzeigen

@ -79,7 +79,8 @@ public class SchematicCommands {
@Command( @Command(
aliases = { "load" }, aliases = { "load" },
usage = "[<format>] <filename>", usage = "[<format>] <filename>",
desc = "Load a schematic into your clipboard" desc = "Load a schematic into your clipboard",
min = 1, max = 2
) )
@Deprecated @Deprecated
@CommandPermissions({ "worldedit.clipboard.load", "worldedit.schematic.load" }) @CommandPermissions({ "worldedit.clipboard.load", "worldedit.schematic.load" })
@ -102,23 +103,16 @@ public class SchematicCommands {
Closer closer = Closer.create(); Closer closer = Closer.create();
try { try {
String filePath = f.getCanonicalPath(); FileInputStream fis = closer.register(new FileInputStream(f));
String dirPath = dir.getCanonicalPath(); BufferedInputStream bis = closer.register(new BufferedInputStream(fis));
ClipboardReader reader = format.getReader(bis);
if (!filePath.substring(0, dirPath.length()).equals(dirPath)) { WorldData worldData = player.getWorld().getWorldData();
player.printError("Clipboard file could not read or it does not exist."); Clipboard clipboard = reader.read(player.getWorld().getWorldData());
} else { session.setClipboard(new ClipboardHolder(clipboard, worldData));
FileInputStream fis = closer.register(new FileInputStream(f));
BufferedInputStream bis = closer.register(new BufferedInputStream(fis));
ClipboardReader reader = format.getReader(bis);
WorldData worldData = player.getWorld().getWorldData(); log.info(player.getName() + " loaded " + f.getCanonicalPath());
Clipboard clipboard = reader.read(player.getWorld().getWorldData()); player.print(filename + " loaded. Paste it with //paste");
session.setClipboard(new ClipboardHolder(clipboard, worldData));
log.info(player.getName() + " loaded " + filePath);
player.print(filename + " loaded. Paste it with //paste");
}
} catch (IOException e) { } catch (IOException e) {
player.printError("Schematic could not read or it does not exist: " + e.getMessage()); player.printError("Schematic could not read or it does not exist: " + e.getMessage());
log.log(Level.WARNING, "Failed to load a saved clipboard", e); log.log(Level.WARNING, "Failed to load a saved clipboard", e);
@ -133,7 +127,8 @@ public class SchematicCommands {
@Command( @Command(
aliases = { "save" }, aliases = { "save" },
usage = "[<format>] <filename>", usage = "[<format>] <filename>",
desc = "Save a schematic into your clipboard" desc = "Save a schematic into your clipboard",
min = 1, max = 2
) )
@Deprecated @Deprecated
@CommandPermissions({ "worldedit.clipboard.save", "worldedit.schematic.save" }) @CommandPermissions({ "worldedit.clipboard.save", "worldedit.schematic.save" })