Schematic Nodes #90
@ -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
|
||||
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 {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Wenns ein Verzeichnis ist: NULL