Skip to content

Commit

Permalink
Try a different fix for #2353 (#2429)
Browse files Browse the repository at this point in the history
  • Loading branch information
bensku committed Sep 5, 2019
1 parent ae83f58 commit 062a723
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions src/main/java/ch/njol/skript/aliases/ItemData.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,15 @@ public boolean isOfType(@Nullable ItemStack item) {
if (type != item.getType())
return false; // Obvious mismatch

if (ItemUtils.getDamage(stack) != ItemUtils.getDamage(item))
return false; // On 1.12 and below, damage is not in meta
if (stack.hasItemMeta() == item.hasItemMeta()) // Compare ItemMeta as in isSimilar() of ItemStack
return stack.hasItemMeta() ? itemFactory.equals(stack.getItemMeta(), item.getItemMeta()) : true;
else
return false;
if (itemFlags != 0) { // Either stack has tags (or durability)
if (ItemUtils.getDamage(stack) != ItemUtils.getDamage(item))
return false; // On 1.12 and below, damage is not in meta
if (stack.hasItemMeta() == item.hasItemMeta()) // Compare ItemMeta as in isSimilar() of ItemStack
return stack.hasItemMeta() ? itemFactory.equals(stack.getItemMeta(), item.getItemMeta()) : true;
else
return false;
}
return true;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/njol/skript/aliases/ItemType.java
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ public final boolean removeFrom(final List<ItemStack>... lists) {
assert list instanceof RandomAccess;
for (int i = 0; i < list.size(); i++) {
final ItemStack is = list.get(i);
if (is != null && d.isOfType(is)) {
if (is != null && d.equals(new ItemData(is))) {
if (all && amount == -1) {
list.set(i, null);
removed = 1;
Expand Down

0 comments on commit 062a723

Please sign in to comment.