SteamWar/SpigotCore
Archiviert
13
0

Merge branch 'master' into multi-kit

Dieser Commit ist enthalten in:
Chaoscaot 2021-01-09 10:56:54 +01:00
Commit f760ce58d9
2 geänderte Dateien mit 14 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -64,6 +64,7 @@ public class SWException {
reasons.add("Unsupported key:");
reasons.add("ThrownPotion entity");
reasons.add("Couldn't load custom particle");
reasons.add("Chunk file at [");
reasons.add("Ignoring unknown attribute");
reasons.add("Skipping player strafe phase because no player was found");
ignorereasons = Collections.unmodifiableList(reasons);

Datei anzeigen

@ -220,6 +220,16 @@ public class Schematic {
saveFromPlayer(player, true);
}
public void saveFromBytes(byte[] bytes, boolean newFormat) {
Blob blob = SQL.blob();
try {
blob.setBytes(1, bytes);
updateDatabase(blob, newFormat);
} catch (SQLException e) {
throw new SecurityException(e);
}
}
private void saveFromPlayer(Player player, boolean newFormat) throws IOException, NoClipboardException {
Blob blob = SQL.blob();
VersionedRunnable.call(new VersionedRunnable(() -> {
@ -228,18 +238,18 @@ public class Schematic {
} catch (SQLException e) {
throw new RuntimeException(e.getMessage(), e);
}
updateDatabase(blob, player, false);
updateDatabase(blob, false);
}, 8), new VersionedRunnable(() -> {
try {
blob.setBytes(1, Schematic_14.getPlayerClipboard(player, newFormat));
} catch (SQLException exception) {
throw new RuntimeException(exception.getMessage(), exception);
}
updateDatabase(blob, player, newFormat);
updateDatabase(blob, newFormat);
}, 14));
}
private void updateDatabase(Blob blob, Player player, boolean newFormat) {
private void updateDatabase(Blob blob, boolean newFormat) {
SQL.update("UPDATE Schematic SET SchemData = ?, SchemFormat = ? WHERE SchemID = ?", blob, newFormat, schemID);
schemFormat = newFormat;
}