ItemStack.asBukkitStack(null) should return Air. Fixes BUKKIT-3170

This commit is contained in:
feildmaster
2012-12-15 01:33:14 -06:00
parent 0f4c206f9b
commit d20d4dc43a
2 changed files with 5 additions and 4 deletions

View File

@@ -242,6 +242,9 @@ public class CraftItemStack extends ItemStack {
* Copies the NMS stack to return as a strictly-Bukkit stack
*/
public static ItemStack asBukkitStack(net.minecraft.server.ItemStack original) {
if (original == null) {
return new ItemStack(Material.AIR);
}
ItemStack stack = new ItemStack(original.id, original.count, (short) original.getData());
stack.addUnsafeEnchantments(getEnchantments(original));
return stack;