diff --git a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java index 5ab3634..b74a253 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java +++ b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java @@ -22,6 +22,7 @@ package de.steamwar.sql; import com.sk89q.worldedit.extent.clipboard.Clipboard; import de.steamwar.core.Core; import de.steamwar.core.VersionedCallable; +import de.steamwar.core.VersionedRunnable; import org.bukkit.entity.Player; import java.io.IOException; @@ -198,7 +199,6 @@ public class Schematic { } public void loadToPlayer(Player player) throws IOException, NoClipboardException { - ResultSet rs = SQL.select("SELECT SchemData FROM Schematic WHERE SchemID = ?", schemID); try { rs.next(); @@ -206,18 +206,19 @@ public class Schematic { if(blob == null) throw new NoClipboardException(); InputStream is = blob.getBinaryStream(); - switch(Core.getVersion()){ - case 8: - case 9: - case 10: - case 12: + VersionedRunnable.call(new VersionedRunnable(() -> { + try { Schematic_8.setPlayerClipboard(player, is, schemFormat); - break; - case 14: - case 15: - default: + } catch (IOException exception) { + throw new RuntimeException(exception.getMessage(), exception); + } + }, 8), new VersionedRunnable(() -> { + try { Schematic_14.setPlayerClipboard(player, is, schemFormat); - } + } catch (IOException | NoClipboardException exception) { + throw new RuntimeException(exception.getMessage(), exception); + } + }, 14)); } catch (SQLException e) { throw new IOException(e); }