SteamWar/SpigotCore
Archiviert
13
0

add Generate Breadcrumbs

Dieser Commit ist enthalten in:
Chaoscaot 2021-07-10 12:19:55 +02:00
Ursprung 99a2055265
Commit cffb8798e1

Datei anzeigen

@ -296,7 +296,7 @@ public class SchematicNode {
updateDB();
}
public int getParent() {
public Integer getParent() {
return parent;
}
@ -367,13 +367,28 @@ public class SchematicNode {
return NodeMember.getNodeMembers(id);
}
public String generateBreadcrumbs() {
return generateBreadcrumbs("/");
}
public String generateBreadcrumbs(String split) {
StringBuilder builder = new StringBuilder(getName());
SchematicNode currentNode = this;
while (currentNode.parent != null) {
currentNode = currentNode.getParentNode();
builder.insert(0, split)
.insert(0, currentNode.getName());
}
return builder.toString();
}
private void updateDB() {
SQL.update("UPDATE SchematicNode SET NodeName = ?, NodeOwner = ?, ParentNode = ?, NodeItem = ?, NodeType = ?, NodeRank = ? WHERE NodeId = ?",
name, owner, parent == 0?null:parent, item, type, rank, id);
name, owner, parent == 0 ? null : parent, item, type, rank, id);
}
public void delete() {
if(isDir()) {
if (isDir()) {
getSchematicNodeInNode(getId()).forEach(SchematicNode::delete);
}
SQL.update("DELETE FROM SchematicNode WHERE NodeId = ?", id);