diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java | 2 | ||||
-rw-r--r-- | src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java index 4c4f0455..b044e382 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -553,7 +553,7 @@ public final class CraftItemStack extends ItemStack { @Override public boolean hasItemMeta() { - return hasItemMeta(handle); + return hasItemMeta(handle) && !CraftItemFactory.instance().equals(getItemMeta(), null); } static boolean hasItemMeta(net.minecraft.server.ItemStack item) { diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java index 74e37cd9..f66cc81d 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java @@ -11,6 +11,7 @@ import net.minecraft.server.ITileEntity; import net.minecraft.server.Item; import net.minecraft.server.ItemBlock; import net.minecraft.server.ItemBlockWallable; +import net.minecraft.server.NBTTagInt; import org.bukkit.Bukkit; import org.bukkit.Color; @@ -141,6 +142,20 @@ public class ItemMetaTest extends AbstractTestingBase { } @Test + public void testTaggedButNotMeta() { + CraftItemStack craft = CraftItemStack.asCraftCopy(new ItemStack(Material.SHEARS)); + craft.handle.setDamage(0); + + assertThat("Should have NBT tag", CraftItemStack.hasItemMeta(craft.handle), is(true)); + assertThat("NBT Tag should contain Damage", craft.handle.getTag().get("Damage"), instanceOf(NBTTagInt.class)); + assertThat("But we should not have meta", craft.hasItemMeta(), is(false)); + + ItemStack pureBukkit = new ItemStack(Material.SHEARS); + assertThat("Bukkit and craft stacks should be similar", craft.isSimilar(pureBukkit), is(true)); + assertThat("Bukkit and craft stacks should be equal", craft.equals(pureBukkit), is(true)); + } + + @Test public void testBlockStateMeta() { List<Block> queue = new ArrayList<>(); |