mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-21 15:41:19 +01:00
Fixing item bonus issue
This commit is contained in:
parent
f17dfc7c07
commit
7f485bbbc5
@ -17,18 +17,14 @@ public class CMIReflections {
|
|||||||
//private Object CraftServer;
|
//private Object CraftServer;
|
||||||
|
|
||||||
private static Class<?> NBTTagCompound;
|
private static Class<?> NBTTagCompound;
|
||||||
private Class<?> NBTBase;
|
private static Class<?> NBTBase;
|
||||||
// private Class<?> NBTTagList;
|
// private Class<?> NBTTagList;
|
||||||
|
|
||||||
private static Class<?> CraftItemStack;
|
private static Class<?> CraftItemStack;
|
||||||
private static Class<?> Item;
|
private static Class<?> Item;
|
||||||
private static Class<?> IStack;
|
private static Class<?> IStack;
|
||||||
|
|
||||||
public CMIReflections() {
|
static {
|
||||||
initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initialize() {
|
|
||||||
try {
|
try {
|
||||||
//CraftServerClass = getBukkitClass("CraftServer");
|
//CraftServerClass = getBukkitClass("CraftServer");
|
||||||
//CraftServer = CraftServerClass.cast(Bukkit.getServer());
|
//CraftServer = CraftServerClass.cast(Bukkit.getServer());
|
||||||
@ -194,37 +190,6 @@ public class CMIReflections {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// public ItemStack setNbt(ItemStack item, String base, String path, String value) {
|
|
||||||
// if (item == null)
|
|
||||||
// return null;
|
|
||||||
// try {
|
|
||||||
// Object nmsStack = asNMSCopy(item);
|
|
||||||
// Method methTag = nmsStack.getClass().getMethod("getTag");
|
|
||||||
// Object tag = methTag.invoke(nmsStack);
|
|
||||||
// if (tag == null)
|
|
||||||
// tag = NBTTagCompound.newInstance();
|
|
||||||
//
|
|
||||||
// Method compountMeth = tag.getClass().getMethod("getCompound", String.class);
|
|
||||||
// Object compountTag = compountMeth.invoke(tag, base);
|
|
||||||
//
|
|
||||||
// if (compountTag == null)
|
|
||||||
// compountTag = NBTTagCompound.newInstance();
|
|
||||||
//
|
|
||||||
// Method meth = compountTag.getClass().getMethod("setString", String.class, String.class);
|
|
||||||
// meth.invoke(compountTag, path, value);
|
|
||||||
//
|
|
||||||
// Method mm = tag.getClass().getMethod("set", String.class, NBTBase);
|
|
||||||
// mm.invoke(tag, base, compountTag);
|
|
||||||
//
|
|
||||||
// Method meth2 = nmsStack.getClass().getMethod("setTag", NBTTagCompound);
|
|
||||||
// meth2.invoke(nmsStack, tag);
|
|
||||||
// return (ItemStack) asBukkitCopy(nmsStack);
|
|
||||||
// } catch (Throwable e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
public static ItemStack setNbt(ItemStack item, String path, String value) {
|
public static ItemStack setNbt(ItemStack item, String path, String value) {
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return null;
|
return null;
|
||||||
@ -268,6 +233,7 @@ public class CMIReflections {
|
|||||||
Method meth = CraftItemStack.getMethod("asNMSCopy", ItemStack.class);
|
Method meth = CraftItemStack.getMethod("asNMSCopy", ItemStack.class);
|
||||||
return meth.invoke(CraftItemStack, item);
|
return meth.invoke(CraftItemStack, item);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -285,7 +251,8 @@ public class CMIReflections {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
Object nmsStack = asNMSCopy(item);
|
Object nmsStack = asNMSCopy(item);
|
||||||
|
if (nmsStack == null)
|
||||||
|
return null;
|
||||||
if (Version.isCurrentEqualOrHigher(Version.v1_13_R1)) {
|
if (Version.isCurrentEqualOrHigher(Version.v1_13_R1)) {
|
||||||
Object pre = nmsStack.getClass().getMethod("getItem").invoke(nmsStack);
|
Object pre = nmsStack.getClass().getMethod("getItem").invoke(nmsStack);
|
||||||
Object n = pre.getClass().getMethod("getName").invoke(pre);
|
Object n = pre.getClass().getMethod("getName").invoke(pre);
|
||||||
|
@ -114,6 +114,7 @@ public class JobItems {
|
|||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
return item;
|
return item;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user