Update ItemStackUtil

This commit is contained in:
Fabrizio La Rosa 2020-06-26 21:14:40 +02:00
parent d3ee17d037
commit a41b7d27b4

View File

@ -2,8 +2,10 @@ package com.songoda.skyblock.utils.item;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.skyblock.utils.version.NMSUtil;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.inventory.ItemStack;
import java.io.*;
@ -25,9 +27,10 @@ public final class ItemStackUtil {
.getMethod("a", DataInputStream.class).invoke(null, dataInputStream);
Object craftItemStack;
if (NMSUtil.getVersionNumber() > 12) {
assert NMSItemStackClass != null;
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) {
craftItemStack = NMSItemStackClass.getMethod("a", NBTTagCompoundClass).invoke(null, NBTTagCompound);
} else if (NMSUtil.getVersionNumber() > 10) {
} else if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) {
craftItemStack = NMSItemStackClass.getConstructor(NBTTagCompoundClass).newInstance(NBTTagCompound);
} else {
craftItemStack = NMSItemStackClass.getMethod("createStack", NBTTagCompoundClass).invoke(null,