From accb30d96126c42945fed998178955c09474c2c8 Mon Sep 17 00:00:00 2001 From: Patrick Miller Date: Fri, 12 Jul 2024 14:17:49 -0400 Subject: [PATCH] Fix ItemData#equals check (#6888) --- src/main/java/ch/njol/skript/aliases/ItemData.java | 2 +- src/test/skript/tests/syntaxes/effects/EffEquip.sk | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/test/skript/tests/syntaxes/effects/EffEquip.sk diff --git a/src/main/java/ch/njol/skript/aliases/ItemData.java b/src/main/java/ch/njol/skript/aliases/ItemData.java index 0f68279f43a..f18812aabb8 100644 --- a/src/main/java/ch/njol/skript/aliases/ItemData.java +++ b/src/main/java/ch/njol/skript/aliases/ItemData.java @@ -278,7 +278,7 @@ public boolean equals(final @Nullable Object obj) { return false; ItemData other = (ItemData) obj; - if (isAlias) { // This is alias, other item might not be + if (isAlias()) { // This is alias, other item might not be return other.matchAlias(this).isAtLeast(MatchQuality.SAME_ITEM); } else { // This is not alias, but other might be return matchAlias(other).isAtLeast(MatchQuality.SAME_ITEM); diff --git a/src/test/skript/tests/syntaxes/effects/EffEquip.sk b/src/test/skript/tests/syntaxes/effects/EffEquip.sk new file mode 100644 index 00000000000..a4a88a94f28 --- /dev/null +++ b/src/test/skript/tests/syntaxes/effects/EffEquip.sk @@ -0,0 +1,12 @@ +test "equip effect": + spawn a zombie at spawn of "world": + set {_entity} to event-entity + + equip {_entity} with a diamond chestplate + assert chestplate of {_entity} is a diamond chestplate with "entity was not wearing a diamond chestplate" + set chestplate of {_entity} to air + + equip {_entity} with a diamond chestplate named "Test" + assert chestplate of {_entity} is a diamond chestplate named "Test" with "entity was not wearing a named diamond chestplate" + + delete the entity within {_entity}