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-14 01:51:43 +08:00
commit 5bcfdeb971
3 changed files with 38 additions and 1 deletions

View File

@ -30,7 +30,7 @@ public abstract class DisplayItem {
private static Constructor<? extends DisplayItem> constructor;
public static void init() {
List<Class<? extends DisplayItem>> fakeItems = Arrays.asList(FakeItem_19_111.class, FakeItem_18.class, FakeItem_17.class);
List<Class<? extends DisplayItem>> fakeItems = Arrays.asList(FakeItem_19_111.class, FakeItem_17.class);
Log.i("启用虚拟悬浮物 尝试启动中...");
FakeItem.register(plugin);
for (Class<? extends DisplayItem> c : fakeItems) {

View File

@ -44,6 +44,7 @@ public class FakeItem_17 extends FakeItem {
is.write(1, getNormalizedDistance(location.getX()));
is.write(2, getNormalizedDistance(location.getY()));
is.write(3, getNormalizedDistance(location.getZ()));
is.write(9,2);
return fakePacket;
}
}

View File

@ -1,11 +1,13 @@
package org.maxgamer.QuickShop.Util;
import java.lang.reflect.Method;
import java.text.DecimalFormat;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
@ -156,6 +158,8 @@ public class Util {
* @return The human readable item name.
*/
public static String getName(final ItemStack i) {
String S;
if(BS) return (S=getDisplayName(i))==null?L10N.getItemName(i):S;
return L10N.getItemName(i);
}
@ -366,6 +370,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){
}
}
/**