SteamWar/SpigotCore
Archiviert
13
0

Updating SchematicNode
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Chaoscaot 2021-10-08 13:41:19 +02:00
Ursprung 297f72a16e
Commit c1c04367e7

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.sql;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.core.VersionedCallable;
import de.steamwar.core.VersionedRunnable;
import de.steamwar.core.WorldEditWrapper;
import org.bukkit.entity.Player;
import java.io.IOException;
@ -444,8 +445,7 @@ public class SchematicNode {
if(schemData == null)
throw new IOException("NodeData 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 WorldEditWrapper.impl.getClipboard(is, schemFormat);
} catch (SQLException e) {
throw new IOException(e);
}
@ -461,8 +461,7 @@ public class SchematicNode {
if(blob == null)
throw new NoClipboardException();
InputStream is = blob.getBinaryStream();
VersionedRunnable.call(new VersionedRunnable(() -> Schematic_8.setPlayerClipboard(player, is, schemFormat), 8),
new VersionedRunnable(() -> Schematic_14.setPlayerClipboard(player, is, schemFormat), 14));
WorldEditWrapper.impl.setPlayerClipboard(player, is, schemFormat);
} catch (SQLException e) {
throw new IOException(e);
}
@ -496,21 +495,12 @@ public class SchematicNode {
if(isDir)
throw new SecurityException("Node is Directory");
Blob blob = SQL.blob();
VersionedRunnable.call(new VersionedRunnable(() -> {
try {
blob.setBytes(1, Schematic_8.getPlayerClipboard(player));
} catch (SQLException e) {
throw new RuntimeException(e.getMessage(), e);
}
updateDatabase(blob, false);
}, 8), new VersionedRunnable(() -> {
try {
blob.setBytes(1, Schematic_14.getPlayerClipboard(player, newFormat));
blob.setBytes(1, WorldEditWrapper.impl.getPlayerClipboard(player, newFormat));
} catch (SQLException exception) {
throw new RuntimeException(exception.getMessage(), exception);
}
updateDatabase(blob, newFormat);
}, 14));
}
private void updateDatabase(Blob blob, boolean newFormat) {