Signed-off-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
9b5629704c
Commit
e544abf328
@ -53,6 +53,7 @@ public class SchematicSelector {
|
||||
@Getter
|
||||
private boolean singleDirOpen;
|
||||
private boolean sdoTrigger = false;
|
||||
private boolean noDirOpen = true;
|
||||
|
||||
public SchematicSelector(Player player, SelectorTarget target, Consumer<SchematicNode> callback) {
|
||||
this.player = player;
|
||||
@ -80,12 +81,13 @@ public class SchematicSelector {
|
||||
|
||||
if(sdoTrigger) {
|
||||
sdoTrigger = false;
|
||||
openList(nodes.get(0));
|
||||
return;
|
||||
}
|
||||
|
||||
List<SWListInv.SWListEntry<SchematicNode>> list = new ArrayList<>();
|
||||
|
||||
if(parent != null) {
|
||||
if(parent != null && !noDirOpen) {
|
||||
list.add(new SWListInv.SWListEntry<>(new SWItem(Material.ARROW, Core.MESSAGE.parse("SCHEM_SELECTOR_BACK", player), clickType -> {}), null));
|
||||
}
|
||||
|
||||
@ -125,7 +127,25 @@ public class SchematicSelector {
|
||||
|
||||
private void handleClick(SchematicNode node, SchematicNode parent) {
|
||||
if(node == null) {
|
||||
openList(getParent(parent));
|
||||
if(!singleDirOpen) {
|
||||
if(parent.getParent() == null) {
|
||||
noDirOpen = true;
|
||||
}
|
||||
openList(getParent(parent));
|
||||
} else {
|
||||
SchematicNode currentParent = parent;
|
||||
do {
|
||||
sdoTrigger = false;
|
||||
currentParent = getParent(currentParent);
|
||||
if(currentParent == null)
|
||||
break;
|
||||
getSchematicList(currentParent);
|
||||
} while (sdoTrigger);
|
||||
if(currentParent == null) {
|
||||
noDirOpen = true;
|
||||
}
|
||||
openList(currentParent);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(node.isDir()) {
|
||||
@ -135,6 +155,7 @@ public class SchematicSelector {
|
||||
return;
|
||||
}
|
||||
filter.reset();
|
||||
noDirOpen = false;
|
||||
openList(node);
|
||||
return;
|
||||
}
|
||||
@ -308,7 +329,12 @@ public class SchematicSelector {
|
||||
case SCHEMATIC_TYPE:
|
||||
nodes.addAll(SchematicNode.getAccessibleSchematicsOfTypeInParent(user.getId(), target.type.toDB(), parent==null?0:parent.getId()));
|
||||
if(target.rank >= 0) {
|
||||
nodes.removeIf(node -> node.getRank() > target.rank);
|
||||
nodes.removeIf(node -> {
|
||||
if(node.isDir()) {
|
||||
return false;
|
||||
}
|
||||
return node.getRank() > target.rank;
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -316,7 +342,6 @@ public class SchematicSelector {
|
||||
}
|
||||
|
||||
if(singleDirOpen && nodes.size() == 1 && nodes.get(0).isDir()) {
|
||||
openList(nodes.get(0));
|
||||
sdoTrigger = true;
|
||||
}
|
||||
return nodes;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren