SteamWar/SpigotCore
Archiviert
13
0

Change Schematic version dependant calls

Dieser Commit ist enthalten in:
jojo 2020-12-25 19:06:12 +01:00
Ursprung f3ada581af
Commit c646bf9533

Datei anzeigen

@ -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);
}