mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-30 22:53:26 +01:00
Avoid item stack IDs if we can.
This commit is contained in:
parent
125bfbad30
commit
c9fd6b4b93
@ -24,6 +24,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.comphenix.protocol.reflect.FieldAccessException;
|
import com.comphenix.protocol.reflect.FieldAccessException;
|
||||||
@ -162,7 +163,7 @@ public class NbtFactory {
|
|||||||
throw new IllegalArgumentException("Stack cannot be NULL.");
|
throw new IllegalArgumentException("Stack cannot be NULL.");
|
||||||
if (!MinecraftReflection.isCraftItemStack(stack))
|
if (!MinecraftReflection.isCraftItemStack(stack))
|
||||||
throw new IllegalArgumentException("Stack must be a CraftItemStack.");
|
throw new IllegalArgumentException("Stack must be a CraftItemStack.");
|
||||||
if (stack.getTypeId() == 0)
|
if (stack.getType() == Material.AIR)
|
||||||
throw new IllegalArgumentException("ItemStacks representing air cannot store NMS information.");
|
throw new IllegalArgumentException("ItemStacks representing air cannot store NMS information.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user