13
0

Schemnodes Schematic System #93

Zusammengeführt
Lixfel hat 30 Commits von nodes nach master 2021-12-27 16:30:26 +01:00 zusammengeführt
Nur Änderungen aus Commit e28d01ca05 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -95,6 +95,9 @@ public class SchematicSelector {
if(target.target == SelectorTarget.Target.DIRECTORY) { if(target.target == SelectorTarget.Target.DIRECTORY) {
nodes.removeIf(node -> !node.isDir()); nodes.removeIf(node -> !node.isDir());
} }
if(target.target == SelectorTarget.Target.SCHEMATIC_TYPE) {
nodes.removeIf(node -> node.isDir() || !node.getType().equals(target.type.toDB()));
}
} else { } else {
switch (target.target) { switch (target.target) {
case DIRECTORY: case DIRECTORY:
@ -242,27 +245,29 @@ public class SchematicSelector {
inv.setItem(1, item); inv.setItem(1, item);
} }
InvCallback schemTypeCallback = clickType -> { if(target.target == SelectorTarget.Target.SCHEMATIC_TYPE) {
if(clickType.isRightClick()) { InvCallback schemTypeCallback = clickType -> {
filter.setType(null); if(clickType.isRightClick()) {
openFilter(publics); filter.setType(null);
} else {
List<SWListInv.SWListEntry<SchematicType>> types = new ArrayList<>();
SchematicType.values().forEach(schematicType -> {
types.add(new SWListInv.SWListEntry<>(new SWItem(SWItem.getMaterial("STONE_BUTTON"), "§e" + schematicType.name(), Collections.emptyList(), schematicType.fightType(), n -> {}), schematicType));
});
SWListInv<SchematicType> listInv = new SWListInv<>(player, "Typ wählen...", types, (clickType1, schematicType) -> {
filter.setType(schematicType);
openFilter(publics); openFilter(publics);
}); } else {
listInv.open(); List<SWListInv.SWListEntry<SchematicType>> types = new ArrayList<>();
} SchematicType.values().forEach(schematicType -> {
}; types.add(new SWListInv.SWListEntry<>(new SWItem(SWItem.getMaterial("STONE_BUTTON"), "§e" + schematicType.name(), Collections.emptyList(), schematicType.fightType(), n -> {}), schematicType));
});
SWListInv<SchematicType> listInv = new SWListInv<>(player, "Typ wählen...", types, (clickType1, schematicType) -> {
filter.setType(schematicType);
openFilter(publics);
});
listInv.open();
}
};
if(filter.getType() == null) { if(filter.getType() == null) {
inv.setItem(2, SWItem.getMaterial("STONE_BUTTON"), "§7Nach Typ Filtern...", schemTypeCallback); inv.setItem(2, SWItem.getMaterial("STONE_BUTTON"), "§7Nach Typ Filtern...", schemTypeCallback);
} else { } else {
inv.setItem(2, SWItem.getMaterial("STONE_BUTTON"), "§7Nach Typ Filtern...", Collections.singletonList("§7Typ: §e" + filter.getType().name()), true, schemTypeCallback); inv.setItem(2, SWItem.getMaterial("STONE_BUTTON"), "§7Nach Typ Filtern...", Collections.singletonList("§7Typ: §e" + filter.getType().name()), true, schemTypeCallback);
}
} }
InvCallback materialCallback = clickType -> { InvCallback materialCallback = clickType -> {
@ -277,10 +282,12 @@ public class SchematicSelector {
} }
}; };
final int iSlot = target.target== SelectorTarget.Target.SCHEMATIC_TYPE?2:3;
if(filter.getItem() == null) { if(filter.getItem() == null) {
inv.setItem(3, Material.STONE, "§7Nach Item Filtern...", materialCallback); inv.setItem(iSlot, Material.STONE, "§7Nach Item Filtern...", materialCallback);
} else { } else {
inv.setItem(3, filter.getItem(), "§7Nach Item Filtern...", Collections.singletonList("§7Item: §e" + filter.getItem().name()), true, materialCallback); inv.setItem(iSlot, filter.getItem(), "§7Nach Item Filtern...", Collections.singletonList("§7Item: §e" + filter.getItem().name()), true, materialCallback);
} }
inv.setItem(7, SWItem.getDye(1), "§eAbbrechen", clickType -> { inv.setItem(7, SWItem.getDye(1), "§eAbbrechen", clickType -> {