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 23136219dd werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -34,6 +34,7 @@ import java.sql.Timestamp;
import java.time.Instant;
import java.util.*;
import java.util.function.Predicate;
Chaoscaot markierte diese Unterhaltung als gelöst Veraltet
Veraltet
Review

Wenns ein Verzeichnis ist: NULL

Wenns ein Verzeichnis ist: NULL
import java.util.zip.GZIPInputStream;
public class SchematicNode {
@ -435,36 +436,29 @@ public class SchematicNode {
SQL.update("DELETE FROM SchematicNode WHERE NodeId = ?", id);
}
public Clipboard load() throws IOException, NoClipboardException {
if(isDir)
throw new SecurityException("Node is Directory");
public InputStream schemData() throws IOException {
ResultSet rs = SQL.select("SELECT NodeData FROM SchematicNode WHERE NodeId = ?", id);
try {
rs.next();
Blob schemData = rs.getBlob("NodeData");
if(schemData == null)
throw new IOException("NodeData is null");
InputStream is = schemData.getBinaryStream();
return WorldEditWrapper.impl.getClipboard(is, schemFormat);
throw new IOException("SchemData is null");
return new GZIPInputStream(schemData.getBinaryStream());
} catch (SQLException e) {
throw new IOException(e);
}
}
public Clipboard load() throws IOException, NoClipboardException {
if(isDir)
throw new SecurityException("Node is Directory");
return WorldEditWrapper.impl.getClipboard(schemData(), schemFormat);
}
public void loadToPlayer(Player player) throws IOException, NoClipboardException {
if(isDir)
throw new SecurityException("Node is Directory");
ResultSet rs = SQL.select("SELECT NodeData FROM SchematicNode WHERE NodeId = ?", id);
try {
rs.next();
Blob blob = rs.getBlob("NodeData");
if(blob == null)
throw new NoClipboardException();
InputStream is = blob.getBinaryStream();
WorldEditWrapper.impl.setPlayerClipboard(player, is, schemFormat);
} catch (SQLException e) {
throw new IOException(e);
}
WorldEditWrapper.impl.setPlayerClipboard(player, schemData(), schemFormat);
}
public void saveOldFormatFromPlayer(Player player) throws IOException, NoClipboardException {