1
0
mirror of https://e.coding.net/circlecloud/QuickShop.git synced 2024-12-26 07:38:49 +00:00

1.7.10 MOD服悬浮物修复,添加BSRE的语言文件功能。

This commit is contained in:
xjboss 2017-05-14 01:46:31 +08:00
parent 833fe1ac43
commit d77d78e3c0
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){
}
}
/**