SteamWar/SpigotCore
Archiviert
13
0

Fix SchematicNode Type

Dieser Commit ist enthalten in:
Chaoscaot 2021-01-26 00:44:56 +01:00
Ursprung 5a840b2194
Commit 305a9dab2a

Datei anzeigen

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