diff --git a/src/main/java/com/songoda/skyblock/utils/item/ItemStackUtil.java b/src/main/java/com/songoda/skyblock/utils/item/ItemStackUtil.java index 87eee00b..c608c4da 100644 --- a/src/main/java/com/songoda/skyblock/utils/item/ItemStackUtil.java +++ b/src/main/java/com/songoda/skyblock/utils/item/ItemStackUtil.java @@ -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.*; @@ -24,10 +26,11 @@ public final class ItemStackUtil { Object NBTTagCompound = NMSUtil.getNMSClass("NBTCompressedStreamTools") .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,