SteamWar/SpigotCore
Archiviert
13
0

Schematic inputstream api #112

Manuell gemergt
Lixfel hat 1 Commits von schemAPI nach master 2021-08-23 19:11:35 +02:00 zusammengeführt
Nur Änderungen aus Commit a6a5499d0c werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -182,21 +182,28 @@ public class Schematic {
return true;
}
public Clipboard load() throws IOException, NoClipboardException {
public InputStream schemData() throws IOException {
ResultSet rs = SQL.select("SELECT SchemData FROM Schematic WHERE SchemID = ?", schemID);
try {
rs.next();
Blob schemData = rs.getBlob("SchemData");
if(schemData == null)
throw new IOException("SchemData is null");
InputStream is = schemData.getBinaryStream();
return VersionedCallable.call(new VersionedCallable<>(() -> Schematic_8.getClipboard(is, schemFormat), 8),
new VersionedCallable<>(() -> Schematic_14.getClipboard(is, schemFormat), 14));
return schemData.getBinaryStream();
} catch (SQLException e) {
throw new IOException(e);
}
}
public static Clipboard clipboardFromStream(InputStream is, boolean schemFormat) {
return VersionedCallable.call(new VersionedCallable<>(() -> Schematic_8.getClipboard(is, schemFormat), 8),
new VersionedCallable<>(() -> Schematic_14.getClipboard(is, schemFormat), 14));
}
public Clipboard load() throws IOException, NoClipboardException {
return clipboardFromStream(schemData(), schemFormat);
}
public void loadToPlayer(Player player) throws IOException, NoClipboardException {
ResultSet rs = SQL.select("SELECT SchemData FROM Schematic WHERE SchemID = ?", schemID);
try {