diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java b/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java index cdff70f3..f0a1eae5 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java @@ -1175,8 +1175,10 @@ public class MinecraftReflection { /** * Retrieve the net.minecraft.server ItemStack from a Bukkit ItemStack. + *
+ * By convention, item stacks that contain air are usually represented as NULL. * @param stack - the Bukkit ItemStack to convert. - * @return The NMS ItemStack. + * @return The NMS ItemStack, or NULL if the stack represents air. */ public static Object getMinecraftItemStack(ItemStack stack) { // Make sure this is a CraftItemStack diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtFactory.java b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtFactory.java index 97339f97..d2810b55 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtFactory.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/nbt/NbtFactory.java @@ -118,12 +118,12 @@ public class NbtFactory { *
* The item stack must be a wrapper for a CraftItemStack. Use
* {@link MinecraftReflection#getBukkitItemStack(ItemStack)} if not.
- * @param stack - the item stack.
- * @param compound - the new NBT compound.
+ * @param stack - the item stack, cannot be air.
+ * @param compound - the new NBT compound, or NULL to remove it.
+ * @throws IllegalArgumentException If the stack is not a CraftItemStack, or it represents air.
*/
public static void setItemTag(ItemStack stack, NbtCompound compound) {
- if (!MinecraftReflection.isCraftItemStack(stack))
- throw new IllegalArgumentException("Stack must be a CraftItemStack.");
+ checkItemStack(stack);
StructureModifier