From 5a5179cd7344e4b09614e9cc3a7055e57547d0aa Mon Sep 17 00:00:00 2001 From: LMBishop <13875753+LMBishop@users.noreply.github.com> Date: Wed, 8 Sep 2021 00:02:32 +0100 Subject: Made display names no longer a requirement (closes #249) --- .../quests/bukkit/hook/itemgetter/ItemGetterLatest.java | 11 ++++------- .../quests/bukkit/hook/itemgetter/ItemGetter_1_13.java | 11 ++++------- .../quests/bukkit/hook/itemgetter/ItemGetter_Late_1_8.java | 11 ++++------- 3 files changed, 12 insertions(+), 21 deletions(-) (limited to 'bukkit/src/main/java') diff --git a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/itemgetter/ItemGetterLatest.java b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/itemgetter/ItemGetterLatest.java index d2515948..1c7331e1 100644 --- a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/itemgetter/ItemGetterLatest.java +++ b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/itemgetter/ItemGetterLatest.java @@ -45,7 +45,7 @@ public class ItemGetterLatest implements ItemGetter { } List filters = Arrays.asList(excludes); - String cName = config.getString(path + "name", path + "name"); + String cName = config.getString(path + "name"); String cType = config.getString(path + "item", config.getString(path + "type", path + "item")); boolean hasCustomModelData = config.contains(path + "custommodeldata"); int customModelData = config.getInt(path + "custommodeldata", 0); @@ -55,10 +55,6 @@ public class ItemGetterLatest implements ItemGetter { boolean hasAttributeModifiers = config.contains(path + "attributemodifiers"); List> cAttributeModifiers = config.getMapList(path + "attributemodifiers"); - String name; - Material type = null; - int data = 0; - // material ItemStack is = getItemStack(cType); ItemMeta ism = is.getItemMeta(); @@ -98,8 +94,9 @@ public class ItemGetterLatest implements ItemGetter { // name if (!filters.contains(Filter.DISPLAY_NAME)) { - name = Chat.color(cName); - ism.setDisplayName(name); + if (cName != null) { + ism.setDisplayName(Chat.color(cName)); + } } // lore diff --git a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/itemgetter/ItemGetter_1_13.java b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/itemgetter/ItemGetter_1_13.java index f9a488f2..60d93a74 100644 --- a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/itemgetter/ItemGetter_1_13.java +++ b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/itemgetter/ItemGetter_1_13.java @@ -44,7 +44,7 @@ public class ItemGetter_1_13 implements ItemGetter { } List filters = Arrays.asList(excludes); - String cName = config.getString(path + "name", path + "name"); + String cName = config.getString(path + "name"); String cType = config.getString(path + "item", config.getString(path + "type", path + "item")); boolean unbreakable = config.getBoolean(path + "unbreakable", false); List cLore = config.getStringList(path + "lore"); @@ -52,10 +52,6 @@ public class ItemGetter_1_13 implements ItemGetter { boolean hasAttributeModifiers = config.contains(path + "attributemodifiers"); List> cAttributeModifiers = config.getMapList(path + "attributemodifiers"); - String name; - Material type = null; - int data = 0; - // material ItemStack is = getItemStack(cType); ItemMeta ism = is.getItemMeta(); @@ -95,8 +91,9 @@ public class ItemGetter_1_13 implements ItemGetter { // name if (!filters.contains(Filter.DISPLAY_NAME)) { - name = Chat.color(cName); - ism.setDisplayName(name); + if (cName != null) { + ism.setDisplayName(Chat.color(cName)); + } } // lore diff --git a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/itemgetter/ItemGetter_Late_1_8.java b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/itemgetter/ItemGetter_Late_1_8.java index 5e19f095..111415eb 100644 --- a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/itemgetter/ItemGetter_Late_1_8.java +++ b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/itemgetter/ItemGetter_Late_1_8.java @@ -41,15 +41,11 @@ public class ItemGetter_Late_1_8 implements ItemGetter { List filters = Arrays.asList(excludes); - String cName = config.getString(path + "name", path + "name"); + String cName = config.getString(path + "name"); String cType = config.getString(path + "item", config.getString(path + "type", path + "item")); List cLore = config.getStringList(path + "lore"); List cItemFlags = config.getStringList(path + "itemflags"); - String name; - Material type = null; - int data = 0; - // material ItemStack is = getItemStack(cType); ItemMeta ism = is.getItemMeta(); @@ -96,8 +92,9 @@ public class ItemGetter_Late_1_8 implements ItemGetter { // name if (!filters.contains(Filter.DISPLAY_NAME)) { - name = Chat.color(cName); - ism.setDisplayName(name); + if (cName != null) { + ism.setDisplayName(Chat.color(cName)); + } } -- cgit v1.2.3-70-g09d2