From d617c0962e7577ec958a924e2b171a7495cf0823 Mon Sep 17 00:00:00 2001 From: Ben Woodworth Date: Sat, 23 Apr 2016 17:03:32 -0400 Subject: [PATCH] Fixed items with custom names not working with 'gui.item-name' language entry. --- .../java/co/kepler/fastcraftplus/config/LanguageConfig.java | 3 ++- .../co/kepler/fastcraftplus/craftgui/GUIButtonRecipe.java | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/co/kepler/fastcraftplus/config/LanguageConfig.java b/src/main/java/co/kepler/fastcraftplus/config/LanguageConfig.java index b99948e6..8fbefabf 100644 --- a/src/main/java/co/kepler/fastcraftplus/config/LanguageConfig.java +++ b/src/main/java/co/kepler/fastcraftplus/config/LanguageConfig.java @@ -180,7 +180,8 @@ public String gui_title() { } public String gui_itemName(ItemStack item) { - return getNullable("gui.item-name", "name", BukkitUtil.getItemName(item)); + String name = getNullable("gui.item-name", "name", BukkitUtil.getItemName(item)); + return name != null ? name : item.getItemMeta().getDisplayName(); } public List gui_hashcode(FastRecipe recipe) { diff --git a/src/main/java/co/kepler/fastcraftplus/craftgui/GUIButtonRecipe.java b/src/main/java/co/kepler/fastcraftplus/craftgui/GUIButtonRecipe.java index 3f00a105..af6ba8b3 100644 --- a/src/main/java/co/kepler/fastcraftplus/craftgui/GUIButtonRecipe.java +++ b/src/main/java/co/kepler/fastcraftplus/craftgui/GUIButtonRecipe.java @@ -51,9 +51,7 @@ public ItemStack getItem() { Map ingredients = recipe.getIngredients(); // Set the display name of the item - if (!meta.hasDisplayName()) { - meta.setDisplayName(lang.gui_itemName(item)); - } + meta.setDisplayName(lang.gui_itemName(item)); // Add ingredients and amounts to the lore lore.addFirst(lang.gui_ingredients_label());