Fixed 1.16.4

This commit is contained in:
Auxilor
2020-11-03 19:26:04 +00:00
parent e9ca330a33
commit dcb141b903
4 changed files with 9 additions and 12 deletions

View File

@@ -53,11 +53,8 @@ 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." + nmsVersion + ".inventory.CraftItemStack");
Class<?> craftItemStack = Class.forName("org.bukkit.craftbukkit." + EcoEnchantsPlugin.nmsVersion + ".inventory.CraftItemStack");
// Bukkit Result ItemStack from NMS Result ItemStack
ItemStack nmsSelling = (ItemStack) craftItemStack.getMethod("asBukkitCopy", selling.getClass()).invoke(null, selling);