SteamWar/SpigotCore
Archiviert
13
0

Fix replay saving

Dieser Commit ist enthalten in:
Lixfel 2021-05-31 08:14:46 +02:00
Ursprung 8d6c499cd1
Commit 77766621f8

Datei anzeigen

@ -20,7 +20,6 @@
package de.steamwar.sql; package de.steamwar.sql;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream;
import java.sql.Blob; import java.sql.Blob;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -60,16 +59,13 @@ public class Fight {
} }
} }
public static OutputStream setReplay(int fightID) { public static void setReplay(int fightID, byte[] data) {
ResultSet rs = SQL.select("SELECT Replay FROM Fight WHERE FightID = ?", fightID); Blob blob = SQL.blob();
try { try {
rs.next(); blob.setBytes(1, data);
Blob replay = rs.getBlob("Replay");
if(replay == null)
throw new SecurityException("Replay null");
return replay.setBinaryStream(1);
} catch (SQLException e) { } catch (SQLException e) {
throw new SecurityException(e); throw new SecurityException(e);
} }
SQL.update("UPDATE Fight SET Replay = ? WHERE FightID = ?", blob, fightID);
} }
} }