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