Skip to content

Commit

Permalink
implement new core advancedMatches
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Nov 13, 2021
1 parent 8db9ff5 commit 35ccf40
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 1 deletion.
Expand Up @@ -81,7 +81,7 @@ public abstract class BukkitScriptEvent extends ScriptEvent {
// "location_in:<area>": runs AreaObject checks, as defined below.
// If none of the above are used, and the location is at a real block, a MaterialTag matchable is used. Refer to MaterialTag matchable list above.
//
// AreaObject matchers (applies to CuboidTag, EllipsoidTag, PolygonTag, ...), sometimes identified as "<area>":
// AreaObject matchers (applies to CuboidTag, EllipsoidTag, PolygonTag, ...), sometimes identified as "<area>": (Note: this is internally always sourced from a LocationTag instance, not a raw area object!)
// "biome:<name>": matches if the location is in a given biome, using advanced matchers.
// "cuboid" plaintext: matches if the location is in any noted cuboid.
// "ellipsoid" plaintext: matches if the location is in any noted ellipsoid.
Expand Down
Expand Up @@ -3920,4 +3920,9 @@ else if (getBukkitEntity() instanceof Creeper) {

CoreUtilities.autoPropertyMechanism(this, mechanism);
}

@Override
public boolean advancedMatches(String matcher) {
return BukkitScriptEvent.tryEntity(this, matcher);
}
}
Expand Up @@ -2473,4 +2473,9 @@ else if (inventory instanceof BrewerInventory) {
}
}
}

@Override
public boolean advancedMatches(String matcher) {
return BukkitScriptEvent.tryInventory(this, matcher);
}
}
Expand Up @@ -787,4 +787,9 @@ public void adjust(Mechanism mechanism) {

CoreUtilities.autoPropertyMechanism(this, mechanism);
}

@Override
public boolean advancedMatches(String matcher) {
return BukkitScriptEvent.tryItem(this, matcher);
}
}
Expand Up @@ -4362,4 +4362,9 @@ else if (state instanceof Dropper) {

CoreUtilities.autoPropertyMechanism(this, mechanism);
}

@Override
public boolean advancedMatches(String matcher) {
return BukkitScriptEvent.tryLocation(this, matcher);
}
}
Expand Up @@ -684,4 +684,9 @@ public void adjust(Mechanism mechanism) {

CoreUtilities.autoPropertyMechanism(this, mechanism);
}

@Override
public boolean advancedMatches(String matcher) {
return BukkitScriptEvent.tryMaterial(this, matcher);
}
}
@@ -1,6 +1,7 @@
package com.denizenscript.denizen.objects;

import com.denizenscript.denizen.Denizen;
import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizen.npc.traits.*;
import com.denizenscript.denizen.scripts.commands.npc.EngageCommand;
import com.denizenscript.denizen.scripts.containers.core.AssignmentScriptContainer;
Expand Down Expand Up @@ -1850,4 +1851,9 @@ else if ((wp.getCurrentProvider() instanceof WanderWaypointProvider)) {
}
}
}

@Override
public boolean advancedMatches(String matcher) {
return isSpawned() && BukkitScriptEvent.tryEntity(getDenizenEntity(), matcher);
}
}
Expand Up @@ -3747,6 +3747,10 @@ else if (bal > goal) {
}
}
}
}

@Override
public boolean advancedMatches(String matcher) {
return isOnline() && BukkitScriptEvent.tryEntity(getDenizenEntity(), matcher);
}
}
Expand Up @@ -1181,6 +1181,10 @@ public void adjust(Mechanism mechanism) {
}

CoreUtilities.autoPropertyMechanism(this, mechanism);
}

@Override
public boolean advancedMatches(String matcher) {
return BukkitScriptEvent.tryWorld(this, matcher);
}
}

0 comments on commit 35ccf40

Please sign in to comment.