SteamWar/SpigotCore
Archiviert
13
0

Schematic Nodes #90

Zusammengeführt
Lixfel hat 48 Commits von schematic-node nach master 2021-11-20 13:12:32 +01:00 zusammengeführt
Nur Änderungen aus Commit c1c04367e7 werden angezeigt - Alle Commits anzeigen

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));
} catch (SQLException exception) {
throw new RuntimeException(exception.getMessage(), exception);
}
updateDatabase(blob, newFormat);
}, 14));
try {
blob.setBytes(1, WorldEditWrapper.impl.getPlayerClipboard(player, newFormat));
} catch (SQLException exception) {
throw new RuntimeException(exception.getMessage(), exception);
}
updateDatabase(blob, newFormat);
}
private void updateDatabase(Blob blob, boolean newFormat) {