diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/util/SchematicSelector.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/util/SchematicSelector.java index 57000d6..d69bc2c 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/util/SchematicSelector.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/util/SchematicSelector.java @@ -95,6 +95,9 @@ public class SchematicSelector { if(target.target == SelectorTarget.Target.DIRECTORY) { nodes.removeIf(node -> !node.isDir()); } + if(target.target == SelectorTarget.Target.SCHEMATIC_TYPE) { + nodes.removeIf(node -> node.isDir() || !node.getType().equals(target.type.toDB())); + } } else { switch (target.target) { case DIRECTORY: @@ -242,27 +245,29 @@ public class SchematicSelector { inv.setItem(1, item); } - InvCallback schemTypeCallback = clickType -> { - if(clickType.isRightClick()) { - filter.setType(null); - openFilter(publics); - } else { - List> 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 listInv = new SWListInv<>(player, "Typ wählen...", types, (clickType1, schematicType) -> { - filter.setType(schematicType); + if(target.target == SelectorTarget.Target.SCHEMATIC_TYPE) { + InvCallback schemTypeCallback = clickType -> { + if(clickType.isRightClick()) { + filter.setType(null); openFilter(publics); - }); - listInv.open(); - } - }; + } else { + List> 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 listInv = new SWListInv<>(player, "Typ wählen...", types, (clickType1, schematicType) -> { + filter.setType(schematicType); + openFilter(publics); + }); + listInv.open(); + } + }; - if(filter.getType() == null) { - inv.setItem(2, SWItem.getMaterial("STONE_BUTTON"), "§7Nach Typ Filtern...", schemTypeCallback); - } else { - inv.setItem(2, SWItem.getMaterial("STONE_BUTTON"), "§7Nach Typ Filtern...", Collections.singletonList("§7Typ: §e" + filter.getType().name()), true, schemTypeCallback); + if(filter.getType() == null) { + inv.setItem(2, SWItem.getMaterial("STONE_BUTTON"), "§7Nach Typ Filtern...", schemTypeCallback); + } else { + inv.setItem(2, SWItem.getMaterial("STONE_BUTTON"), "§7Nach Typ Filtern...", Collections.singletonList("§7Typ: §e" + filter.getType().name()), true, schemTypeCallback); + } } 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) { - inv.setItem(3, Material.STONE, "§7Nach Item Filtern...", materialCallback); + inv.setItem(iSlot, Material.STONE, "§7Nach Item Filtern...", materialCallback); } 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 -> {