Add SaveFromBytes
Dieser Commit ist enthalten in:
Ursprung
753611dd8d
Commit
40c2462d5b
@ -212,15 +212,25 @@ public class Schematic {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveOldFormatFromPlayer(Player player) throws IOException, NoClipboardException {
|
public void saveOldFormatFromPlayer(Player player) throws NoClipboardException {
|
||||||
saveFromPlayer(player, false);
|
saveFromPlayer(player, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveFromPlayer(Player player) throws IOException, NoClipboardException {
|
public void saveFromPlayer(Player player) throws NoClipboardException {
|
||||||
saveFromPlayer(player, true);
|
saveFromPlayer(player, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveFromPlayer(Player player, boolean newFormat) throws IOException, NoClipboardException {
|
public void saveFromBytes(byte[] bytes, boolean newFormat) {
|
||||||
|
Blob blob = SQL.blob();
|
||||||
|
try {
|
||||||
|
blob.setBytes(1, bytes);
|
||||||
|
updateDatabase(blob, newFormat);
|
||||||
|
} catch (SQLException throwables) {
|
||||||
|
throwables.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveFromPlayer(Player player, boolean newFormat) throws NoClipboardException {
|
||||||
Blob blob = SQL.blob();
|
Blob blob = SQL.blob();
|
||||||
VersionedRunnable.call(new VersionedRunnable(() -> {
|
VersionedRunnable.call(new VersionedRunnable(() -> {
|
||||||
try {
|
try {
|
||||||
@ -228,18 +238,18 @@ public class Schematic {
|
|||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new RuntimeException(e.getMessage(), e);
|
throw new RuntimeException(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
updateDatabase(blob, player, false);
|
updateDatabase(blob, false);
|
||||||
}, 8), new VersionedRunnable(() -> {
|
}, 8), new VersionedRunnable(() -> {
|
||||||
try {
|
try {
|
||||||
blob.setBytes(1, Schematic_14.getPlayerClipboard(player, newFormat));
|
blob.setBytes(1, Schematic_14.getPlayerClipboard(player, newFormat));
|
||||||
} catch (SQLException exception) {
|
} catch (SQLException exception) {
|
||||||
throw new RuntimeException(exception.getMessage(), exception);
|
throw new RuntimeException(exception.getMessage(), exception);
|
||||||
}
|
}
|
||||||
updateDatabase(blob, player, newFormat);
|
updateDatabase(blob, newFormat);
|
||||||
}, 14));
|
}, 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);
|
SQL.update("UPDATE Schematic SET SchemData = ?, SchemFormat = ? WHERE SchemID = ?", blob, newFormat, schemID);
|
||||||
schemFormat = newFormat;
|
schemFormat = newFormat;
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren