Skip to content

Commit

Permalink
EntityProperty.getReasonNotDescribed
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Apr 17, 2023
1 parent 1c85503 commit 600451e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Expand Up @@ -2980,13 +2980,11 @@ public void applyProperty(Mechanism mechanism) {

@Override
public void adjust(Mechanism mechanism) {

if (isGeneric()) {
mechanisms.add(mechanism);
mechanism.fulfill();
return;
}

if (getBukkitEntity() == null) {
if (isCitizensNPC()) {
mechanism.echoError("Cannot adjust not-spawned NPC " + getDenizenNPC());
Expand Down
Expand Up @@ -32,4 +32,14 @@ public EntityType getType() {
public <T extends Entity> T as(Class<T> entityClass) {
return (T) getEntity();
}

public static String getReasonNotDescribed(EntityTag entity) {
if (entity.getUUID() == null) {
return "generic entity-types cannot match any properties, you must spawn an entity to interact with its properties directly.";
}
else if (!entity.isSpawnedOrValidForTag()) {
return "that entity is not spawned.";
}
return "unspecified reason - are you sure this property applies to that EntityType?";
}
}

0 comments on commit 600451e

Please sign in to comment.