SteamWar/SpigotCore
Archiviert
13
0

Fixes, Fixes, damn Fixes
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Chaoscaot 2021-12-08 18:54:13 +01:00
Ursprung 79050e3b09
Commit d1ca48436c
2 geänderte Dateien mit 20 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.inventory;
import de.steamwar.core.Core;
import de.steamwar.sql.NodeMember;
import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SchematicType;
import de.steamwar.sql.SteamwarUser;
@ -53,7 +54,9 @@ public class SchematicSelector {
@Getter
private boolean singleDirOpen;
private boolean sdoTrigger = false;
private boolean noDirOpen = true;
@Getter
@Setter
private int openedDirs = 0;
public SchematicSelector(Player player, SelectorTarget target, Consumer<SchematicNode> callback) {
this.player = player;
@ -87,7 +90,7 @@ public class SchematicSelector {
List<SWListInv.SWListEntry<SchematicNode>> list = new ArrayList<>();
if(parent != null && !noDirOpen) {
if(parent != null && openedDirs != 0) {
list.add(new SWListInv.SWListEntry<>(new SWItem(Material.ARROW, Core.MESSAGE.parse("SCHEM_SELECTOR_BACK", player), clickType -> {}), null));
}
@ -127,24 +130,31 @@ public class SchematicSelector {
private void handleClick(SchematicNode node, SchematicNode parent) {
if(node == null) {
openedDirs--;
if(!singleDirOpen) {
if(parent.getParent() == null) {
noDirOpen = true;
if(NodeMember.getNodeMember(parent.getId(), user.getId()) != null) {
openList(null);
} else {
openList(getParent(parent));
}
openList(getParent(parent));
} else {
SchematicNode currentParent = parent;
boolean isMember = false;
do {
sdoTrigger = false;
if(NodeMember.getNodeMember(currentParent.getId(), user.getId()) != null) {
isMember = true;
}
currentParent = getParent(currentParent);
if(currentParent == null)
break;
getSchematicList(currentParent);
} while (sdoTrigger);
if(currentParent == null) {
noDirOpen = true;
if(isMember || NodeMember.getNodeMember(parent.getId(), user.getId()) != null) {
openList(null);
} else {
openList(currentParent);
}
openList(currentParent);
}
return;
}
@ -155,7 +165,7 @@ public class SchematicSelector {
return;
}
filter.reset();
noDirOpen = false;
openedDirs++;
openList(node);
return;
}

Datei anzeigen

@ -488,13 +488,10 @@ public class SchematicNode {
StringBuilder builder = new StringBuilder(getName());
SchematicNode currentNode = this;
if (currentNode.isDir()) builder.append("/");
while (currentNode.getParentNode() != null) {
while (currentNode.getParentNode() != null && !currentNode.getMembers().stream().anyMatch(member -> member.getMember() == user.getId())) {
currentNode = currentNode.getParentNode();
builder.insert(0, split)
.insert(0, currentNode.getName());
if (currentNode.getMembers().stream().anyMatch(member -> member.getMember() == user.getId())) {
break;
}
}
return builder.toString();
}