Skip to content

Commit

Permalink
Add script item advanced matcher (#2403)
Browse files Browse the repository at this point in the history
* add script item advanced matcher

* move boolean
  • Loading branch information
Hydroxycobalamin committed Nov 30, 2022
1 parent 8f84061 commit 6247103
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -78,6 +78,7 @@ public class ItemTag implements ObjectTag, Adjustable, FlaggableObject {
// @Matchable
// ItemTag matchers, sometimes identified as "<item>", often seen as "with:<item>":
// "potion": plaintext: matches if the item is any form of potion item.
// "script": plaintext: matches if the item is any form of script item.
// "item_flagged:<flag>": A Flag Matcher for item flags.
// "item_enchanted:<enchantment>": matches if the item is enchanted with the given enchantment name. Allows advanced matchers.
// "raw_exact:<item>": matches based on exact raw item data comparison (almost always a bad idea to use).
Expand Down Expand Up @@ -943,14 +944,17 @@ else if (matcherLow.startsWith("raw_exact:")) {
if (matcherLow.equals("potion") && CoreUtilities.toLowerCase(getBukkitMaterial().name()).contains("potion")) {
return true;
}
boolean isItemScript = isItemscript();
if (matcherLow.equals("script") && isItemScript) {
return true;
}
if (matcher.contains("[") && matcher.endsWith("]")) {
ItemPropertyMatchHelper helper = getPropertyMatchHelper(matcher);
if (helper == null) {
return false;
}
return helper.doesMatch(this);
}
boolean isItemScript = isItemscript();
if (isItemScript) {
ScriptEvent.MatchHelper matchHelper = BukkitScriptEvent.createMatcher(matcher);
if (matchHelper.doesMatch(getScriptName())) {
Expand Down

0 comments on commit 6247103

Please sign in to comment.