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