Skip to content

Commit

Permalink
player places block: couldMatch: allow mixed list of item and block
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jan 25, 2021
1 parent 8996f47 commit f5bef48
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
Expand Up @@ -156,6 +156,23 @@ public boolean couldMatchVehicle(String text) {
return genericCouldMatchChecks(text, this::couldMatchVehicle);
}

public boolean couldMatchBlockOrItem(String text) {
if (text.equals("block") || text.equals("material") || text.equals("item") || text.startsWith("item_flagged:")) {
return true;
}
if (MaterialTag.matches(text)) {
MaterialTag mat = MaterialTag.valueOf(text, CoreUtilities.noDebugContext);
if (mat == null) {
return false;
}
return true;
}
if (ItemTag.matches(text)) {
return true;
}
return genericCouldMatchChecks(text, this::couldMatchBlockOrItem);
}

public boolean couldMatchBlock(String text) {
if (text.equals("block") || text.equals("material")) {
return true;
Expand Down
Expand Up @@ -55,7 +55,7 @@ public boolean couldMatch(ScriptPath path) {
if (!path.eventLower.startsWith("player places")) {
return false;
}
if (!couldMatchItem(path.eventArgLowerAt(2)) && !couldMatchBlock(path.eventArgLowerAt(2))) {
if (!couldMatchBlockOrItem(path.eventArgLowerAt(2))) {
return false;
}
return true;
Expand Down
Expand Up @@ -437,6 +437,12 @@ public EntityTag duplicate() {

@Override
public AbstractFlagTracker getFlagTracker() {
if (isCitizensNPC()) {
return getDenizenNPC().getFlagTracker();
}
else if (isPlayer()) {
return getDenizenPlayer().getFlagTracker();
}
Entity ent = getBukkitEntity();
if (ent != null) {
return new DataPersistenceFlagTracker(ent);
Expand Down

0 comments on commit f5bef48

Please sign in to comment.