diff options
| author | LMBishop <13875753+LMBishop@users.noreply.github.com> | 2021-09-08 00:02:32 +0100 |
|---|---|---|
| committer | LMBishop <13875753+LMBishop@users.noreply.github.com> | 2021-09-08 00:02:32 +0100 |
| commit | 5a5179cd7344e4b09614e9cc3a7055e57547d0aa (patch) | |
| tree | 43c10aaf8f33b6b071783b6cdae07423265f1e53 /bukkit | |
| parent | 8c23b92cbee4b35e0083f848eac670f7e3b4e31b (diff) | |
Made display names no longer a requirement (closes #249)
Diffstat (limited to 'bukkit')
3 files changed, 12 insertions, 21 deletions
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<Filter> 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<Map<?, ?>> 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<Filter> 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<String> cLore = config.getStringList(path + "lore"); @@ -52,10 +52,6 @@ public class ItemGetter_1_13 implements ItemGetter { boolean hasAttributeModifiers = config.contains(path + "attributemodifiers"); List<Map<?, ?>> 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<Filter> 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<String> cLore = config.getStringList(path + "lore"); List<String> 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)); + } } |
