Add Reopen to SchematicSelector #169
@ -58,6 +58,8 @@ public class SchematicSelector {
|
||||
private int depth = 0;
|
||||
private Sorting sorting = Sorting.NAME;
|
||||
private boolean invertSorting = false;
|
||||
@Getter
|
||||
private SchematicNode lastParent;
|
||||
|
||||
public SchematicSelector(Player player, SelectorTarget target, Consumer<SchematicNode> callback) {
|
||||
this.player = player;
|
||||
@ -77,10 +79,17 @@ public class SchematicSelector {
|
||||
if(publicMode == PublicMode.PUBLIC_ONLY) {
|
||||
this.user = SteamwarUser.get(0);
|
||||
}
|
||||
injectable.onSelectorOpen(this, SchematicSelectorInjectable.OpenFrom.FRESH);
|
||||
openList(null);
|
||||
}
|
||||
|
||||
public void reOpen() {
|
||||
injectable.onSelectorOpen(this, SchematicSelectorInjectable.OpenFrom.REOPEN);
|
||||
openList(lastParent);
|
||||
}
|
||||
|
||||
private void openList(SchematicNode parent) {
|
||||
lastParent = parent;
|
||||
List<SchematicNode> nodes = applySorting(filter.isFilter()?getFilteredSchematics():getSchematicList(parent));
|
||||
|
||||
if(sdoTrigger) {
|
||||
|
@ -42,4 +42,11 @@ public interface SchematicSelectorInjectable {
|
||||
default boolean onFolderCreate(SchematicSelector selector, String name) {return true;}
|
||||
|
||||
default void onNodeFilter(SchematicSelector selector, SchematicNode node) {}
|
||||
|
||||
default void onSelectorOpen(SchematicSelector selector, OpenFrom from) {}
|
||||
|
||||
enum OpenFrom {
|
||||
FRESH,
|
||||
REOPEN
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren