Dieser Commit ist enthalten in:
Ursprung
87d43e608a
Commit
23136219dd
@ -34,6 +34,7 @@ import java.sql.Timestamp;
|
|||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
public class SchematicNode {
|
public class SchematicNode {
|
||||||
|
|
||||||
@ -435,36 +436,29 @@ public class SchematicNode {
|
|||||||
SQL.update("DELETE FROM SchematicNode WHERE NodeId = ?", id);
|
SQL.update("DELETE FROM SchematicNode WHERE NodeId = ?", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Clipboard load() throws IOException, NoClipboardException {
|
public InputStream schemData() throws IOException {
|
||||||
if(isDir)
|
|
||||||
throw new SecurityException("Node is Directory");
|
|
||||||
ResultSet rs = SQL.select("SELECT NodeData FROM SchematicNode WHERE NodeId = ?", id);
|
ResultSet rs = SQL.select("SELECT NodeData FROM SchematicNode WHERE NodeId = ?", id);
|
||||||
try {
|
try {
|
||||||
rs.next();
|
rs.next();
|
||||||
Blob schemData = rs.getBlob("NodeData");
|
Blob schemData = rs.getBlob("NodeData");
|
||||||
if(schemData == null)
|
if(schemData == null)
|
||||||
throw new IOException("NodeData is null");
|
throw new IOException("SchemData is null");
|
||||||
InputStream is = schemData.getBinaryStream();
|
return new GZIPInputStream(schemData.getBinaryStream());
|
||||||
return WorldEditWrapper.impl.getClipboard(is, schemFormat);
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new IOException(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 {
|
public void loadToPlayer(Player player) throws IOException, NoClipboardException {
|
||||||
if(isDir)
|
if(isDir)
|
||||||
throw new SecurityException("Node is Directory");
|
throw new SecurityException("Node is Directory");
|
||||||
ResultSet rs = SQL.select("SELECT NodeData FROM SchematicNode WHERE NodeId = ?", id);
|
WorldEditWrapper.impl.setPlayerClipboard(player, schemData(), schemFormat);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveOldFormatFromPlayer(Player player) throws IOException, NoClipboardException {
|
public void saveOldFormatFromPlayer(Player player) throws IOException, NoClipboardException {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren