From 82421d95441b050a2a65573652962509933f4e03 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 27 Nov 2021 10:34:53 +0100 Subject: [PATCH] Fixing... Signed-off-by: Chaoscaot --- SpigotCore_Main/src/SpigotCore.properties | 2 +- .../de/steamwar/util/SchematicSelector.java | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/SpigotCore_Main/src/SpigotCore.properties b/SpigotCore_Main/src/SpigotCore.properties index 8f75226..66ec9a1 100644 --- a/SpigotCore_Main/src/SpigotCore.properties +++ b/SpigotCore_Main/src/SpigotCore.properties @@ -19,7 +19,7 @@ SCHEM_SELECTOR_TITLE={0} auswählen: {1} SCHEM_SELECTOR_BACK=§eZurück -SCHEM_SELECTOR_DIR=Ordner +SCHEM_SELECTOR_DIR=§9Ordner SCHEM_SELECTOR_RANK=§8Rang {0} SCHEM_SELECTOR_OWN=§7Eigene Schematics SCHEM_SELECTOR_PUB=§7Public Schematics diff --git a/SpigotCore_Main/src/de/steamwar/util/SchematicSelector.java b/SpigotCore_Main/src/de/steamwar/util/SchematicSelector.java index f992c53..ba3ff0c 100644 --- a/SpigotCore_Main/src/de/steamwar/util/SchematicSelector.java +++ b/SpigotCore_Main/src/de/steamwar/util/SchematicSelector.java @@ -97,7 +97,7 @@ public class SchematicSelector { list.add(renderItem(node)); } - SWListInv inv = new SWListInv<>(player, MessageFormat.format(injectable.createTitle(player), target.target.getName(player), filter.getName().isEmpty()?(parent == null?"/":parent.generateBreadcrumbs(user)):filter.getName()), false, list, (clickType, node) -> handleClick(node, parent)); + SWListInv inv = new SWListInv<>(player, MessageFormat.format(injectable.createTitle(player), target.target.getName(player), filter.getName() == null?(parent == null?"/":parent.generateBreadcrumbs(user)):filter.getName()), false, list, (clickType, node) -> handleClick(node, parent)); if(publicMode == PublicMode.ALL) { if(user.getId() == 0) { inv.setItem(48, Material.BUCKET, Core.MESSAGE.parse("SCHEM_SELECTOR_OWN", player), clickType -> { @@ -152,13 +152,13 @@ public class SchematicSelector { else m = SWItem.getMaterial(node.getItem()); - String name = "§" + (filter.getName().isEmpty()?"e":"7") + node.getName(); + String name = "§" + (filter.getName() == null?"e":"7") + node.getName(); - if(!filter.getName().isEmpty()) { + if(filter.getName() != null) { name = name.replace(filter.getName(), "§e" + filter.getName() + "§7"); } - SWItem item = new SWItem(m, name, Collections.singletonList(node.isDir() ? ("§9" + Core.MESSAGE.parse("SCHEM_SELECTOR_DIR", player)) : "§7" + node.getSchemtype().name()), !node.isDir() && !node.getSchemtype().writeable(), click -> { + SWItem item = new SWItem(m, name, Collections.singletonList(node.isDir() ? (Core.MESSAGE.parse("SCHEM_SELECTOR_DIR", player)) : "§7" + node.getSchemtype().name()), !node.isDir() && !node.getSchemtype().writeable(), click -> { }); if(!node.isDir() && node.getRank() > 0) { item.setLore(Arrays.asList("§7" + node.getSchemtype().name(), Core.MESSAGE.parse("SCHEM_SELECTOR_RANK", player))); @@ -182,7 +182,7 @@ public class SchematicSelector { SWInventory inv = new SWInventory(player, 9, Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_TITLE", player)); InvCallback nameCallback = clickType -> { if(clickType.isRightClick()) { - filter.setName(""); + filter.setName(null); openFilter(); } else { SWAnvilInv swAnvilInv = new SWAnvilInv(player, Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_ENTER_NAME", player)); @@ -194,7 +194,7 @@ public class SchematicSelector { swAnvilInv.open(); } }; - if(filter.getName().isEmpty()) { + if(filter.getName() == null) { inv.setItem(0, Material.NAME_TAG, Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_NAME", player), nameCallback); } else { inv.setItem(0, Material.NAME_TAG, Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_NAME", player), Collections.singletonList(Core.MESSAGE.parse("SCHEM_SELECTOR_FILTER_NAME_SEARCH", player, filter.getName())), true, nameCallback); @@ -386,13 +386,13 @@ public class SchematicSelector { private boolean filter; - private String name = ""; + private String name = null; private Integer owner = null; private SchematicType type = null; private Material item = null; public void reset() { - name = ""; + name = null; owner = null; type = null; item = null; @@ -401,7 +401,7 @@ public class SchematicSelector { public boolean matches(SchematicNode node) { boolean matches = true; - if(!name.isEmpty() && !node.getName().contains(name)) { + if(name != null && !node.getName().contains(name)) { matches = false; }