diff --git a/src/main/java/net/citizensnpcs/api/npc/AbstractNPC.java b/src/main/java/net/citizensnpcs/api/npc/AbstractNPC.java
index 4f6991df..80a0f55d 100644
--- a/src/main/java/net/citizensnpcs/api/npc/AbstractNPC.java
+++ b/src/main/java/net/citizensnpcs/api/npc/AbstractNPC.java
@@ -178,6 +178,11 @@ public boolean hasTrait(Class extends Trait> trait) {
return traits.containsKey(trait);
}
+ @Override
+ public boolean isProtected() {
+ return data().get(NPC.DEFAULT_PROTECTED_METADATA, true);
+ }
+
@Override
public void removeTrait(Class extends Trait> traitClass) {
Trait trait = traits.remove(traitClass);
@@ -233,6 +238,11 @@ public void setName(String name) {
}
}
+ @Override
+ public void setProtected(boolean isProtected) {
+ data().setPersistent(NPC.DEFAULT_PROTECTED_METADATA, isProtected);
+ }
+
public void update() {
for (int i = 0; i < runnables.size(); ++i) {
runnables.get(i).run();
diff --git a/src/main/java/net/citizensnpcs/api/npc/NPC.java b/src/main/java/net/citizensnpcs/api/npc/NPC.java
index c0eddce3..d2c342f8 100644
--- a/src/main/java/net/citizensnpcs/api/npc/NPC.java
+++ b/src/main/java/net/citizensnpcs/api/npc/NPC.java
@@ -71,6 +71,11 @@ public interface NPC extends Agent, Cloneable {
*/
public void destroy();
+ /**
+ * Faces a given {@link Location} if the NPC is spawned.
+ */
+ public void faceLocation(Location location);
+
/**
* Gets the Bukkit entity associated with this NPC. This may be
* null
if {@link #isSpawned()} is false.
@@ -156,6 +161,8 @@ public interface NPC extends Agent, Cloneable {
*/
public boolean hasTrait(Class extends Trait> trait);
+ public boolean isProtected();
+
/**
* Gets whether this NPC is currently spawned.
*
@@ -212,6 +219,17 @@ public interface NPC extends Agent, Cloneable {
*/
public void setName(String name);
+ /**
+ * A helper method for using {@link #DEFAULT_PROTECTED_METADATA} to set the
+ * NPC as protected or not protected from damage/entity target events.
+ * Equivalent to
+ * npc.data().set(NPC.DEFAULT_PROTECTED_METADATA, isProtected);
+ *
+ * @param isProtected
+ * Whether the NPC should be protected
+ */
+ public void setProtected(boolean isProtected);
+
/**
* Attempts to spawn this NPC.
*