From 45cd628537becb90fcb5f93e4c869edd664d32a7 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Fri, 16 Sep 2016 16:59:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B0=83=E6=95=B4=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- src/main/java/pw/yumc/YumCore/misc/L10N.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/pw/yumc/YumCore/misc/L10N.java b/src/main/java/pw/yumc/YumCore/misc/L10N.java index 74ccd94..6b9b322 100644 --- a/src/main/java/pw/yumc/YumCore/misc/L10N.java +++ b/src/main/java/pw/yumc/YumCore/misc/L10N.java @@ -35,7 +35,7 @@ public class L10N { * 物品实体 * @return 物品名称 */ - public static final String getItemFullName(final ItemStack i) { + public static final String getFullName(final ItemStack i) { return getItemName(getItemType(i)) + (i.hasItemMeta() && i.getItemMeta().hasDisplayName() ? "§r(" + i.getItemMeta().getDisplayName() + "§r)" : ""); } @@ -47,6 +47,17 @@ public class L10N { * @return 物品名称 */ public static final String getItemName(final ItemStack i) { + return getItemName(getItemType(i)); + } + + /** + * 获取物品汉化名称(优先显示名称) + * + * @param i + * 物品实体 + * @return 物品名称 + */ + public static final String getName(final ItemStack i) { return i.hasItemMeta() && i.getItemMeta().hasDisplayName() ? i.getItemMeta().getDisplayName() : getItemName(getItemType(i)); }