From d0d75a1ca668aa39327362e3de2310d4c933b5e6 Mon Sep 17 00:00:00 2001 From: xjboss Date: Tue, 9 May 2017 00:01:12 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86BossShop-Re?= =?UTF-8?q?=E7=9A=84=E8=AF=AD=E8=A8=80=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E6=A3=80=E6=B5=8B=E5=88=B0=E6=9C=8D=E5=8A=A1=E5=99=A8?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E4=BA=86BS-RE=E5=B0=86=E7=A6=81=E7=94=A8YumC?= =?UTF-8?q?ore=E9=87=8C=E7=9A=84=E8=AF=AD=E8=A8=80=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../org/maxgamer/QuickShop/Util/Util.java | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7df3611..49fb55a 100644 --- a/pom.xml +++ b/pom.xml @@ -78,7 +78,7 @@ pw.yumc YumCore jar - 1.8 + 1.7 io.github.Cnly.WowSuchCleaner diff --git a/src/main/java/org/maxgamer/QuickShop/Util/Util.java b/src/main/java/org/maxgamer/QuickShop/Util/Util.java index a7229b8..4100a7e 100644 --- a/src/main/java/org/maxgamer/QuickShop/Util/Util.java +++ b/src/main/java/org/maxgamer/QuickShop/Util/Util.java @@ -1,5 +1,6 @@ package org.maxgamer.QuickShop.Util; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; @@ -20,6 +21,7 @@ import org.maxgamer.QuickShop.QuickShop; import pw.yumc.YumCore.bukkit.Log; import pw.yumc.YumCore.global.L10N; +import java.lang.reflect.Method; import java.text.DecimalFormat; import java.util.HashSet; import java.util.List; @@ -157,6 +159,10 @@ public class Util { * @return The human readable item name. */ public static String getName(final ItemStack i) { + if(BS){ + String S; + return (S=getDisplayName(i))==null?L10N.getItemName(i):S; + } return L10N.getItemName(i); } @@ -368,6 +374,38 @@ public class Util { addTransparentBlock(Material.BREWING_STAND); addTransparentBlock(Material.WOODEN_DOOR); addTransparentBlock(Material.WOOD_STEP); + BS=false; + try { + Class.forName("org.black_ixx.bossshop.managers.ItemNameManager"); + plugin.getLogger().info("检测到bossshop-re已经加载,使用bsre的物品名称功能。"); + BSplug= Bukkit.getPluginManager().getPlugin("BossShop"); + BS=true; + BSREItemLang(); + }catch (Throwable e){ + plugin.getLogger().info("检测到bossshop-re没有加载,使用内置的物品名称功能。"); + } + } + private static Object BSplug; + private static Method BS_GIS; + private static Object BS_IM; + private static boolean BS=false; + public static String getDisplayName(final ItemStack item){ + try { + BS_GIS.setAccessible(true); + return (String) BS_GIS.invoke(BS_IM, item); + }catch (Throwable e){} + return null; + } + private static void BSREItemLang(){ + try { + Class BSLM = Class.forName("org.black_ixx.bossshop.managers.ItemNameManager"); + Method GM=BSplug.getClass().getMethod("getManager",Class.class); + BS_IM=GM.invoke(BSplug,BSLM); + BS_GIS=BS_IM.getClass().getMethod("getDisplayName",ItemStack.class); + BS=true; + }catch (Throwable e){ + + } } /** From 77c8b7aa93ba41375ad9ad0490abc15d0fb129cb Mon Sep 17 00:00:00 2001 From: xjboss Date: Tue, 9 May 2017 00:08:54 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=86plugin.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/plugin.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 95b1818..000d45e 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -10,6 +10,7 @@ authors: softdepend: - Vault - WowSuchCleaner +- B website: ${ciManagement.url} commands: qs: From e2e76c95c7e11a9dff33c2ab420f97af6d69b80f Mon Sep 17 00:00:00 2001 From: xjboss Date: Tue, 9 May 2017 00:17:39 +0800 Subject: [PATCH 3/3] ??? --- src/main/resources/plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 000d45e..414173b 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -10,7 +10,7 @@ authors: softdepend: - Vault - WowSuchCleaner -- B +- BossShop website: ${ciManagement.url} commands: qs: