From 025591e6d92cf241e7714b544c06ac39047ceb8e Mon Sep 17 00:00:00 2001 From: wizjany Date: Fri, 19 Jun 2015 18:27:20 -0400 Subject: [PATCH] Don't double-check for symlinks while loading schematics. Fixes WORLDEDIT-3310. --- .../worldedit/command/SchematicCommands.java | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java index 459ecf72c..817be6368 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java @@ -79,7 +79,8 @@ public class SchematicCommands { @Command( aliases = { "load" }, usage = "[] ", - desc = "Load a schematic into your clipboard" + desc = "Load a schematic into your clipboard", + min = 1, max = 2 ) @Deprecated @CommandPermissions({ "worldedit.clipboard.load", "worldedit.schematic.load" }) @@ -102,23 +103,16 @@ public class SchematicCommands { Closer closer = Closer.create(); try { - String filePath = f.getCanonicalPath(); - String dirPath = dir.getCanonicalPath(); + FileInputStream fis = closer.register(new FileInputStream(f)); + BufferedInputStream bis = closer.register(new BufferedInputStream(fis)); + ClipboardReader reader = format.getReader(bis); - 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)); - BufferedInputStream bis = closer.register(new BufferedInputStream(fis)); - ClipboardReader reader = format.getReader(bis); + WorldData worldData = player.getWorld().getWorldData(); + Clipboard clipboard = reader.read(player.getWorld().getWorldData()); + session.setClipboard(new ClipboardHolder(clipboard, worldData)); - WorldData worldData = player.getWorld().getWorldData(); - Clipboard clipboard = reader.read(player.getWorld().getWorldData()); - session.setClipboard(new ClipboardHolder(clipboard, worldData)); - - log.info(player.getName() + " loaded " + filePath); - player.print(filename + " loaded. Paste it with //paste"); - } + log.info(player.getName() + " loaded " + f.getCanonicalPath()); + player.print(filename + " loaded. Paste it with //paste"); } catch (IOException e) { player.printError("Schematic could not read or it does not exist: " + e.getMessage()); log.log(Level.WARNING, "Failed to load a saved clipboard", e); @@ -133,7 +127,8 @@ public class SchematicCommands { @Command( aliases = { "save" }, usage = "[] ", - desc = "Save a schematic into your clipboard" + desc = "Save a schematic into your clipboard", + min = 1, max = 2 ) @Deprecated @CommandPermissions({ "worldedit.clipboard.save", "worldedit.schematic.save" })