Skip to content

Commit

Permalink
Add potion effect type comparator (#6832)
Browse files Browse the repository at this point in the history
* DefaultComparators - fix potion effect type match

* DefaultComparators - fix potion effect type match - add test

* DefaultComparators - update pickle suggestion

---------

Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
  • Loading branch information
ShaneBeee and sovdeeth authored Jul 1, 2024
1 parent 13b230c commit 9db5426
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffectType;
import org.skriptlang.skript.lang.comparator.Comparator;
import org.skriptlang.skript.lang.comparator.Comparators;
import org.skriptlang.skript.lang.comparator.Relation;
Expand Down Expand Up @@ -653,6 +654,9 @@ public boolean supportsOrdering() {
return false;
}
});

// Potion Effect Type
Comparators.registerComparator(PotionEffectType.class, PotionEffectType.class, (one, two) -> Relation.get(one.equals(two)));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test "compare potion effect types":
assert nausea = nausea with "2 nausea potion effect types should match"
assert type of (potion effect of nausea for 1 minute) = nausea with "type of potion effect of nausea should equal nausea"

0 comments on commit 9db5426

Please sign in to comment.