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 305a9dab2a werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -39,22 +39,25 @@ public class SchematicNode {
private static SchematicNode createSchematicNode(int owner, String name, int parent, String type) {
SQL.update("INSERT INTO SchematicNode (NodeName, NodeOwner, ParentNode, NodeType) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE NodeName = VALUE(NodeName), ParentNode = VALUE(ParentNode), NodeItem = VALUE(NodeItem), NodeType = VALUE(NodeType)",
name, owner, parent, type);
return getSchematicNode(owner, name, type, parent);
return getSchematicNode(owner, name, parent);
}
public static SchematicNode getSchematicNode(int owner, String name, String type, int parent) {
ResultSet set = SQL.select("SELECT * FROM SchematicNode WHERE NodeOwner = ? AND NodeName = ? AND NodeType = ? AND ParentNode = ?", owner, name, type, parent);
public static SchematicNode getSchematicNode(int owner, String name, int parent) {
ResultSet set = SQL.select("SELECT * FROM SchematicNode WHERE NodeOwner = ? AND NodeName = ? AND ParentNode = ?", owner, name, parent);
try {
if(!set.next())
return null;
return new SchematicNode(set);
while (set.next()) {
SchematicNode node = new SchematicNode(set);
if(!node.isDir())
return node;
}
return null;
}catch (SQLException e) {
throw new SecurityException("Failed to load Schemnodes", e);
}
}
public static SchematicNode getSchematicNode(int owner, String name, String type, SchematicNode parent) {
return getSchematicNode(owner, name, type, parent.getId());
public static SchematicNode getSchematicNode(int owner, String name, SchematicNode parent) {
return getSchematicNode(owner, name, parent.getId());
}
public static List<SchematicNode> getSchematicNodeInNode(int parent) {
@ -74,11 +77,21 @@ public class SchematicNode {
}
public static SchematicNode getSchematicDirectory(int owner, String name, SchematicNode parent) {
return getSchematicNode(owner, name, DIR_TYPE, parent);
return getSchematicDirectory(owner, name, parent.getId());
}
public static SchematicNode getSchematicDirectory(int owner, String name, int parent) {
return getSchematicNode(owner, name, DIR_TYPE, parent);
ResultSet set = SQL.select("SELECT * FROM SchematicNode WHERE NodeOwner = ? AND NodeName = ? AND ParentNode = ?", owner, name, parent);
try {
while (set.next()) {
SchematicNode node = new SchematicNode(set);
if(node.isDir())
return node;
}
return null;
}catch (SQLException e) {
throw new SecurityException("Failed to load Schemnodes", e);
}
}
public static SchematicNode getSchematicNode(int id) {