Skip to content

Commit

Permalink
Add some metadata constants
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Feb 1, 2014
1 parent ef63835 commit ef8b67c
Showing 1 changed file with 31 additions and 28 deletions.
59 changes: 31 additions & 28 deletions src/main/java/net/citizensnpcs/api/npc/NPC.java
Expand Up @@ -27,15 +27,15 @@ public interface NPC extends Agent, Cloneable {
* Adds a trait to this NPC. This will use the {@link TraitFactory} defined
* for this NPC to construct and attach a trait using
* {@link #addTrait(Trait)}.
*
*
* @param trait
* The class of the trait to add
*/
public void addTrait(Class<? extends Trait> trait);

/**
* Adds a trait to this NPC.
*
*
* @param trait
* Trait to add
*/
Expand All @@ -55,14 +55,14 @@ public interface NPC extends Agent, Cloneable {
/**
* Despawns this NPC. This is equivalent to calling
* {@link #despawn(DespawnReason)} with {@link DespawnReason#PLUGIN}.
*
*
* @return Whether this NPC was able to despawn
*/
public boolean despawn();

/**
* Despawns this NPC.
*
*
* @param reason
* The reason for despawning, for use in {@link NPCDespawnEvent}
* @return Whether this NPC was able to despawn
Expand All @@ -83,7 +83,7 @@ public interface NPC extends Agent, Cloneable {
/**
* Gets the Bukkit entity associated with this NPC. This may be
* <code>null</code> if {@link #isSpawned()} is false.
*
*
* @return Entity associated with this NPC
* @deprecated Use {@link #getEntity()} instead
* @see #getEntity()
Expand All @@ -93,44 +93,44 @@ public interface NPC extends Agent, Cloneable {

/**
* Gets the default {@link GoalController} of this NPC.
*
*
* @return Default goal controller
*/
public GoalController getDefaultGoalController();

/**
* Gets the default {@link SpeechController} of this NPC.
*
*
* @return Default speech controller
*/
public SpeechController getDefaultSpeechController();

/**
* Gets the Bukkit entity associated with this NPC. This may be
* <code>null</code> if {@link #isSpawned()} is false.
*
*
* @return Entity associated with this NPC
*/
public Entity getEntity();

/**
* Gets the full name of this NPC.
*
*
* @return Full name of this NPC
*/
public String getFullName();

/**
* Gets the unique ID of this NPC. This is not guaranteed to be globally
* unique across server sessions.
*
*
* @return ID of this NPC
*/
public int getId();

/**
* Gets the name of this NPC with color codes stripped.
*
*
* @return Stripped name of this NPC
*/
public String getName();
Expand All @@ -146,7 +146,7 @@ public interface NPC extends Agent, Cloneable {
* If the NPC is not spawned, then this method will return the last known
* location, or null if it has never been spawned. Otherwise, it is
* equivalent to calling <code>npc.getBukkitEntity().getLocation()</code>.
*
*
* @return The stored location, or <code>null</code> if none was found.
*/
public Location getStoredLocation();
Expand All @@ -155,7 +155,7 @@ public interface NPC extends Agent, Cloneable {
* Gets a trait from the given class. If the NPC does not currently have the
* trait then it will be created and attached using {@link #addTrait(Class)}
* .
*
*
* @param trait
* Trait to get
* @return Trait with the given name
Expand All @@ -164,22 +164,22 @@ public interface NPC extends Agent, Cloneable {

/**
* Returns the currently attached {@link Trait}s
*
*
* @return An Iterable of the current traits
*/
public Iterable<Trait> getTraits();

/**
* Gets the unique id of this NPC. This is guaranteed to be unique for all
* NPCs.
*
*
* @return The unique id
*/
public UUID getUniqueId();

/**
* Checks if this NPC has the given trait.
*
*
* @param trait
* Trait to check
* @return Whether this NPC has the given trait
Expand All @@ -188,22 +188,22 @@ public interface NPC extends Agent, Cloneable {

/**
* Returns whether this NPC is flyable or not.
*
*
* @return Whether this NPC is flyable
*/
public boolean isFlyable();

/**
* Gets whether this NPC is protected from damage, movement and other events
* that players and mobs use to change the entity state of the NPC.
*
*
* @return Whether this NPC is protected
*/
public boolean isProtected();

/**
* Gets whether this NPC is currently spawned.
*
*
* @return Whether this NPC is spawned
*/
public boolean isSpawned();
Expand All @@ -212,15 +212,15 @@ public interface NPC extends Agent, Cloneable {
* Loads the {@link NPC} from the given {@link DataKey}. This reloads all
* traits, respawns the NPC and sets it up for execution. Should not be
* called often.
*
*
* @param key
* The root data key
*/
public void load(DataKey key);

/**
* Removes a trait from this NPC.
*
*
* @param trait
* Trait to remove
*/
Expand All @@ -230,7 +230,7 @@ public interface NPC extends Agent, Cloneable {
* Saves the {@link NPC} to the given {@link DataKey}. This includes all
* metadata, traits, and spawn information that will allow it to respawn at
* a later time via {@link #load(DataKey)}.
*
*
* @param key
* The root data key
*/
Expand All @@ -241,7 +241,7 @@ public interface NPC extends Agent, Cloneable {
* <em>living</em> entity types, with scope for additional types in the
* future. The NPC will respawned if currently spawned, or will remain
* despawned otherwise.
*
*
* @param type
* The new mob type
* @throws IllegalArgumentException
Expand All @@ -253,14 +253,14 @@ public interface NPC extends Agent, Cloneable {
* Sets whether this NPC is <tt>flyable</tt> or not. Note that this is
* intended for normally <em>ground-based</em> entities only - it will
* generally have no effect on mob types that were originally flyable.
*
*
* @param flyable
*/
public void setFlyable(boolean flyable);

/**
* Sets the name of this NPC.
*
*
* @param name
* Name to give this NPC
*/
Expand All @@ -271,15 +271,15 @@ public interface NPC extends Agent, Cloneable {
* NPC as protected or not protected from damage/entity target events.
* Equivalent to
* <code>npc.data().set(NPC.DEFAULT_PROTECTED_METADATA, isProtected);</code>
*
*
* @param isProtected
* Whether the NPC should be protected
*/
public void setProtected(boolean isProtected);

/**
* Attempts to spawn this NPC.
*
*
* @param location
* Location to spawn this NPC
* @return Whether this NPC was able to spawn at the location
Expand All @@ -289,7 +289,7 @@ public interface NPC extends Agent, Cloneable {
/**
* An alternative to {{@link #getBukkitEntity().getLocation()} that
* teleports passengers as well.
*
*
* @param location
* The destination location
* @param cause
Expand All @@ -304,6 +304,9 @@ public interface NPC extends Agent, Cloneable {
public static final String FLYABLE_METADATA = "flyable";
public static final String HURT_SOUND_METADATA = "hurt-sound";
public static final String LEASH_PROTECTED_METADATA = "protected-leash";
public static final String MINECART_ITEM_DATA_METADATA = "minecart-item-data";
public static final String MINECART_ITEM_METADATA = "minecart-item-name";
public static final String MINECART_OFFSET_METADATA = "minecart-item-offset";
public static final String RESPAWN_DELAY_METADATA = "respawn-delay";
public static final String SWIMMING_METADATA = "swim";
public static final String TARGETABLE_METADATA = "protected-target";
Expand Down

0 comments on commit ef8b67c

Please sign in to comment.