From 340c8caaea366519fb88eba19765997b97c85f8e Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Thu, 27 Jan 2022 17:40:37 -0500 Subject: [PATCH] Fix #31 --- .../net/seanomik/energeticstorage/gui/ESTerminalGUI.java | 7 ++++++- .../java/net/seanomik/energeticstorage/utils/Utils.java | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/seanomik/energeticstorage/gui/ESTerminalGUI.java b/src/main/java/net/seanomik/energeticstorage/gui/ESTerminalGUI.java index 99ba550..9d9a29c 100644 --- a/src/main/java/net/seanomik/energeticstorage/gui/ESTerminalGUI.java +++ b/src/main/java/net/seanomik/energeticstorage/gui/ESTerminalGUI.java @@ -321,8 +321,13 @@ public class ESTerminalGUI implements InventoryHolder, Listener { int amount = entry.getValue(); text = text.toLowerCase(); + List lore = itemMeta.getLore(); - if (Utils.listStringContainsString(lore, text) || itemMeta.getDisplayName().toLowerCase().contains(text) || item.getType().toString().toLowerCase().contains(text) || item.getType().toString().toLowerCase().replace("_", " ").contains(text)) { + if (Utils.listStringContainsString(lore, text) || + itemMeta.getLocalizedName().toLowerCase().contains(text) || + itemMeta.getDisplayName().toLowerCase().contains(text) || + item.getType().name().toLowerCase().contains(text) || + item.getType().name().toLowerCase().replace("_", " ").contains(text)) { search.put(item, amount); } } diff --git a/src/main/java/net/seanomik/energeticstorage/utils/Utils.java b/src/main/java/net/seanomik/energeticstorage/utils/Utils.java index 193a912..6c8eaf6 100644 --- a/src/main/java/net/seanomik/energeticstorage/utils/Utils.java +++ b/src/main/java/net/seanomik/energeticstorage/utils/Utils.java @@ -121,6 +121,8 @@ public class Utils { } public static boolean listStringContainsString(List list, String string) { + if (list == null || list.isEmpty()) return false; + string = string.toLowerCase(); for (String str : list) { if (str.toLowerCase().contains(string)) {