From 68deed14691f962d34d580ba6539a8baa1d71de7 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sat, 26 Sep 2020 21:56:38 +0100 Subject: [PATCH] schematics are just fun --- .../clipboard/io/BuiltInClipboardFormat.java | 43 +------------------ 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/BuiltInClipboardFormat.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/BuiltInClipboardFormat.java index af58a3f59..9cce51ec8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/BuiltInClipboardFormat.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/BuiltInClipboardFormat.java @@ -24,11 +24,8 @@ import com.boydti.fawe.object.io.ResettableFileInputStream; import com.boydti.fawe.object.schematic.MinecraftStructure; import com.boydti.fawe.object.schematic.PNGWriter; import com.google.common.collect.ImmutableSet; -import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.NBTInputStream; import com.sk89q.jnbt.NBTOutputStream; -import com.sk89q.jnbt.NamedTag; -import com.sk89q.jnbt.Tag; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -37,7 +34,6 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.util.Map; import java.util.Set; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; @@ -77,25 +73,7 @@ public enum BuiltInClipboardFormat implements ClipboardFormat { @Override public boolean isFormat(File file) { String name = file.getName().toLowerCase(); - if (name.endsWith(".schematic")) { - try (NBTInputStream str = new NBTInputStream(new GZIPInputStream(new FileInputStream(file)))) { - NamedTag rootTag = str.readNamedTag(); - if (!rootTag.getName().equals("Schematic")) { - return false; - } - CompoundTag schematicTag = (CompoundTag) rootTag.getTag(); - - // Check - Map schematic = schematicTag.getValue(); - if (!schematic.containsKey("Materials")) { - return false; - } - } catch (Exception e) { - return false; - } - return true; - } - return name.endsWith(".mcedit") || name.endsWith(".mce"); + return name.endsWith(".schematic") || name.endsWith(".mcedit") || name.endsWith(".mce"); } }, SPONGE_SCHEMATIC("sponge", "schem") { @@ -131,24 +109,7 @@ public enum BuiltInClipboardFormat implements ClipboardFormat { @Override public boolean isFormat(File file) { String name = file.getName().toLowerCase(); - if (name.endsWith(".schem") || name.endsWith(".sponge")) { - try (NBTInputStream str = new NBTInputStream(new GZIPInputStream(new FileInputStream(file)))) { - NamedTag rootTag = str.readNamedTag(); - if (!rootTag.getName().equals("Schematic")) { - return false; - } - CompoundTag schematicTag = (CompoundTag) rootTag.getTag(); - - // Check - Map schematic = schematicTag.getValue(); - if (!schematic.containsKey("Version")) { - return false; - } - } catch (Exception e) { - return false; - } - } - return false; + return name.endsWith(".schem") || name.endsWith(".sponge"); } },