1
0
mirror of https://e.coding.net/circlecloud/QuickShop.git synced 2024-10-31 22:38:45 +00:00
This commit is contained in:
Coding 2017-05-09 00:17:45 +08:00
commit 3a53bafaa8
3 changed files with 40 additions and 1 deletions

View File

@ -78,7 +78,7 @@
<groupId>pw.yumc</groupId>
<artifactId>YumCore</artifactId>
<type>jar</type>
<version>1.8</version>
<version>1.7</version>
</dependency>
<dependency>
<groupId>io.github.Cnly.WowSuchCleaner</groupId>

View File

@ -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){
}
}
/**

View File

@ -10,6 +10,7 @@ authors:
softdepend:
- Vault
- WowSuchCleaner
- BossShop
website: ${ciManagement.url}
commands:
qs: