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

Fixes WORLDEDIT-3310.
This commit is contained in:
wizjany 2015-06-19 18:27:20 -04:00
parent b4d574273d
commit 025591e6d9

View File

@ -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,12 +103,6 @@ public class SchematicCommands {
Closer closer = Closer.create(); Closer closer = Closer.create();
try { try {
String filePath = f.getCanonicalPath();
String dirPath = dir.getCanonicalPath();
if (!filePath.substring(0, dirPath.length()).equals(dirPath)) {
player.printError("Clipboard file could not read or it does not exist.");
} else {
FileInputStream fis = closer.register(new FileInputStream(f)); FileInputStream fis = closer.register(new FileInputStream(f));
BufferedInputStream bis = closer.register(new BufferedInputStream(fis)); BufferedInputStream bis = closer.register(new BufferedInputStream(fis));
ClipboardReader reader = format.getReader(bis); ClipboardReader reader = format.getReader(bis);
@ -116,9 +111,8 @@ public class SchematicCommands {
Clipboard clipboard = reader.read(player.getWorld().getWorldData()); Clipboard clipboard = reader.read(player.getWorld().getWorldData());
session.setClipboard(new ClipboardHolder(clipboard, worldData)); session.setClipboard(new ClipboardHolder(clipboard, worldData));
log.info(player.getName() + " loaded " + filePath); log.info(player.getName() + " loaded " + f.getCanonicalPath());
player.print(filename + " loaded. Paste it with //paste"); 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" })