Skip to content

Commit

Permalink
add tag element.advanced_matches
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Nov 20, 2020
1 parent d6bec18 commit 01a118e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
@@ -1,5 +1,6 @@
package com.denizenscript.denizencore.objects.core;

import com.denizenscript.denizencore.events.ScriptEvent;
import com.denizenscript.denizencore.objects.*;
import com.denizenscript.denizencore.scripts.commands.Comparable;
import com.denizenscript.denizencore.tags.*;
Expand Down Expand Up @@ -894,6 +895,21 @@ else if (CoreUtilities.toLowerCase(element).contains(CoreUtilities.toLowerCase(c
return new ElementTag(object.element.equals(attribute.getContext(1)));
}, "equals_with_case");

// <--[tag]
// @attribute <ElementTag.advanced_matches[<matcher>]>
// @returns ElementTag(Boolean)
// @group element checking
// @description
// Returns whether the element matches some matcher text, using the system behind <@link language Advanced Script Event Matching>.
// -->
registerTag("advanced_matches", (attribute, object) -> {
if (!attribute.hasContext(1)) {
attribute.echoError("The tag ElementTag.advanced_matches[...] must have a value.");
return null;
}
return new ElementTag(ScriptEvent.createMatcher(attribute.getContext(1)).doesMatch(object.element));
});

// <--[tag]
// @attribute <ElementTag.matches[<regex>]>
// @returns ElementTag(Boolean)
Expand Down
Expand Up @@ -28,7 +28,7 @@ public void run(ReplaceableTagEvent event) {
}

// <--[language]
// @name Escape Tags
// @name Escaping System
// @group Useful Lists
// @description
// Sometimes, you need to avoid having symbols that might be misinterpreted in your data.
Expand Down

0 comments on commit 01a118e

Please sign in to comment.