From ea312f88a2e8917c0e176ce61e0815658e29f72e Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 10 Dec 2019 17:48:37 +0100 Subject: [PATCH] Fixing AutoCheck for new Schematic in dbs --- .../schematicsystem/CheckSchemType_12.java | 14 ++++++-------- .../schematicsystem/CheckSchemType_14.java | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/SchematicSystem_12/src/de/steamwar/schematicsystem/CheckSchemType_12.java b/SchematicSystem_12/src/de/steamwar/schematicsystem/CheckSchemType_12.java index 62ab362..f3a0cec 100644 --- a/SchematicSystem_12/src/de/steamwar/schematicsystem/CheckSchemType_12.java +++ b/SchematicSystem_12/src/de/steamwar/schematicsystem/CheckSchemType_12.java @@ -1,17 +1,15 @@ package de.steamwar.schematicsystem; -import com.boydti.fawe.FaweAPI; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.regions.Region; +import de.steamwar.sql.NoClipboardException; import de.steamwar.sql.Schematic; -import de.steamwar.sql.SteamwarUser; import org.bukkit.Bukkit; import org.bukkit.Material; -import java.io.File; import java.io.IOException; import java.util.HashSet; import java.util.List; @@ -68,12 +66,12 @@ class CheckSchemType_12 { static void autoCheck(Schematic schematic, List errors, List warnings, ICheckSchemType type) { Clipboard clipboard; - try { - clipboard = FaweAPI.load(new File(Constants.SCHEM_DIR + SteamwarUser.get(schematic.getSchemOwner()).getUUID(), schematic.getSchemName() + ".schematic")).getClipboard(); - if(clipboard == null) - throw new IOException(); - } catch (IOException e) { + clipboard = schematic.load(); + } catch (Schematic.WrongVersionException e) { + errors.add("Der Schematictyp dieser Schematic kann nicht in dieser Version geändert werden."); + return; + } catch (IOException | NoClipboardException e) { Bukkit.getLogger().log(Level.SEVERE, "Schematic could not be loaded", e); errors.add("Die Schematic konnte nicht geladen werden"); return; diff --git a/SchematicSystem_14/src/de/steamwar/schematicsystem/CheckSchemType_14.java b/SchematicSystem_14/src/de/steamwar/schematicsystem/CheckSchemType_14.java index 3a8e242..ca0012b 100644 --- a/SchematicSystem_14/src/de/steamwar/schematicsystem/CheckSchemType_14.java +++ b/SchematicSystem_14/src/de/steamwar/schematicsystem/CheckSchemType_14.java @@ -1,17 +1,15 @@ package de.steamwar.schematicsystem; -import com.boydti.fawe.FaweAPI; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.world.block.BaseBlock; +import de.steamwar.sql.NoClipboardException; import de.steamwar.sql.Schematic; -import de.steamwar.sql.SteamwarUser; import org.bukkit.Bukkit; import org.bukkit.Material; -import java.io.File; import java.io.IOException; import java.util.EnumSet; import java.util.List; @@ -54,12 +52,12 @@ class CheckSchemType_14 { static void autoCheck(Schematic schematic, List errors, List warnings, ICheckSchemType type) { Clipboard clipboard; - try { - clipboard = FaweAPI.load(new File(Constants.SCHEM_DIR + SteamwarUser.get(schematic.getSchemOwner()).getUUID(), schematic.getSchemName() + ".schematic")).getClipboard(); - if(clipboard == null) - throw new IOException(); - } catch (IOException e) { + clipboard = schematic.load(); + } catch (Schematic.WrongVersionException e) { + errors.add("Der Schematictyp dieser Schematic kann nicht in dieser Version geändert werden."); + return; + } catch (IOException | NoClipboardException e) { Bukkit.getLogger().log(Level.SEVERE, "Schematic could not be loaded", e); errors.add("Die Schematic konnte nicht geladen werden"); return;