SteamWar/BungeeCore
Archiviert
13
2

Fix CheckCommand #270

Zusammengeführt
YoyoNow hat 1 Commits von check_fix nach master 2021-11-20 21:06:15 +01:00 zusammengeführt
2 geänderte Dateien mit 13 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -239,7 +239,7 @@ public class CheckCommand extends BasicCommand {
return;
}
ArenaMode mode = ArenaMode.getBySchemType(schematic.getSchemtype());
ArenaMode mode = ArenaMode.getBySchemType(schematic.getSchemtype().fightType());
SubserverSystem.startTestServer(checker, mode, FightCommand.getMap(checker, mode, "Random"), schematic.getId(), 0);
currentCheckers.put(checker.getUniqueId(), this);
currentSchems.put(schematic.getId(), this);

Datei anzeigen

@ -32,7 +32,6 @@ import java.util.function.Predicate;
import java.util.zip.GZIPInputStream;
public class SchematicNode {
private static final Statement createNode = new Statement("INSERT INTO SchematicNode (NodeName, NodeOwner, ParentNode, NodeType, NodeItem) VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE NodeName = VALUES(NodeName), ParentNode = VALUES(ParentNode), NodeItem = VALUES(NodeItem), NodeType = VALUES(NodeType), NodeItem = VALUES(NodeItem)");
private static final Statement getSchematicNode_Null = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, NodeFormat, LastUpdate FROM SchematicNode WHERE NodeOwner = ? AND NodeName = ? AND ParentNode is NULL");
private static final Statement getSchematicNode = new Statement("SELECT NodeId, NodeName, NodeOwner, ParentNode, NodeType, NodeItem, NodeRank, NodeFormat, LastUpdate FROM SchematicNode WHERE NodeOwner = ? AND NodeName = ? AND ParentNode = ?");
@ -69,7 +68,7 @@ public class SchematicNode {
}
public static SchematicNode createSchematicNode(int owner, String name, Integer parent, String type, String item) {
if (parent == 0)
if (parent != null && parent == 0)
parent = null;
createNode.update(name, owner, parent, type, item);
return getSchematicNode(owner, name, parent);
@ -86,6 +85,9 @@ public class SchematicNode {
owner = set.getInt("NodeOwner");
name = set.getString("NodeName");
parent = set.getInt("ParentNode");
if(set.wasNull()) {
parent = null;
}
item = set.getString("NodeItem");
type = set.getString("NodeType");
lastUpdate = set.getTimestamp("LastUpdate");
@ -409,6 +411,7 @@ public class SchematicNode {
}
public SchematicNode getParentNode() {
if(parent == null) return null;
return SchematicNode.getSchematicNode(parent);
}
@ -449,6 +452,13 @@ public class SchematicNode {
this.brCache.clear();
}
public void delete() {
if (isDir()) {
getSchematicNodeInNode(getId()).forEach(SchematicNode::delete);
}
deleteNode.update(id);
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof SchematicNode))