mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-12-27 20:37:34 +01:00
Fixed craftitemstack
This commit is contained in:
parent
813fa3f4e8
commit
e9ca330a33
@ -53,8 +53,11 @@ public final class PacketOpenWindowMerchant extends AbstractPacketAdapter {
|
||||
Object selling = fSelling.get(handle); // NMS Selling ItemStack
|
||||
modifiersField.setInt(fSelling, fSelling.getModifiers() & ~Modifier.FINAL);
|
||||
|
||||
String nmsVersion = EcoEnchantsPlugin.nmsVersion; // Fuck you spigot for making me do this
|
||||
if(nmsVersion.equalsIgnoreCase("v1_16_R3")) nmsVersion = "v1_16_R2";
|
||||
|
||||
// Reflectively access CraftItemStack.class for respective version
|
||||
Class<?> craftItemStack = Class.forName("org.bukkit.craftbukkit." + EcoEnchantsPlugin.nmsVersion + ".inventory.CraftItemStack");
|
||||
Class<?> craftItemStack = Class.forName("org.bukkit.craftbukkit." + nmsVersion + ".inventory.CraftItemStack");
|
||||
|
||||
// Bukkit Result ItemStack from NMS Result ItemStack
|
||||
ItemStack nmsSelling = (ItemStack) craftItemStack.getMethod("asBukkitCopy", selling.getClass()).invoke(null, selling);
|
||||
|
Loading…
Reference in New Issue
Block a user