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){ + + } } /** diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 95b1818..414173b 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -10,6 +10,7 @@ authors: softdepend: - Vault - WowSuchCleaner +- BossShop website: ${ciManagement.url} commands: qs: