Change Schematic version dependant calls
Dieser Commit ist enthalten in:
Ursprung
c646bf9533
Commit
2c0c75e6ea
@ -20,7 +20,6 @@
|
|||||||
package de.steamwar.sql;
|
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.VersionedCallable;
|
import de.steamwar.core.VersionedCallable;
|
||||||
import de.steamwar.core.VersionedRunnable;
|
import de.steamwar.core.VersionedRunnable;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -233,26 +232,27 @@ public class Schematic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void saveFromPlayer(Player player, boolean newFormat) throws IOException, NoClipboardException {
|
private void saveFromPlayer(Player player, boolean newFormat) throws IOException, NoClipboardException {
|
||||||
try{
|
|
||||||
Blob blob = SQL.blob();
|
Blob blob = SQL.blob();
|
||||||
switch(Core.getVersion()){
|
VersionedRunnable.call(new VersionedRunnable(() -> {
|
||||||
case 8:
|
try {
|
||||||
case 9:
|
|
||||||
case 10:
|
|
||||||
case 12:
|
|
||||||
newFormat = false;
|
|
||||||
blob.setBytes(1, Schematic_8.getPlayerClipboard(player));
|
blob.setBytes(1, Schematic_8.getPlayerClipboard(player));
|
||||||
break;
|
} catch (IOException | NoClipboardException | SQLException e) {
|
||||||
case 14:
|
throw new RuntimeException(e.getMessage(), e);
|
||||||
case 15:
|
|
||||||
default:
|
|
||||||
blob.setBytes(1, Schematic_14.getPlayerClipboard(player, newFormat));
|
|
||||||
}
|
}
|
||||||
|
updateDatabase(blob, player, false);
|
||||||
|
}, 8), new VersionedRunnable(() -> {
|
||||||
|
try {
|
||||||
|
blob.setBytes(1, Schematic_14.getPlayerClipboard(player, newFormat));
|
||||||
|
} catch (IOException | NoClipboardException | SQLException e) {
|
||||||
|
throw new RuntimeException(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
updateDatabase(blob, player, newFormat);
|
||||||
|
}, 14));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateDatabase(Blob blob, Player player, 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;
|
||||||
}catch(SQLException e){
|
|
||||||
throw new IOException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(){
|
public void remove(){
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren