Add leash API. Adds BUKKIT-4459 and BUKKIT-4583

By: T00thpick1 <t00thpick1dirko@gmail.com>
This commit is contained in:
Bukkit/Spigot
2013-07-30 15:40:12 -04:00
parent 47d09288b4
commit fcde9e65af
6 changed files with 194 additions and 0 deletions

View File

@@ -26,6 +26,10 @@ public enum EntityType {
* An experience orb.
*/
EXPERIENCE_ORB("XPOrb", ExperienceOrb.class, 2),
/**
* A leash attached to a fencepost.
*/
LEASH_HITCH("LeashKnot", LeashHitch.class, 8),
/**
* A painting on a wall.
*/

View File

@@ -0,0 +1,7 @@
package org.bukkit.entity;
/**
* Represents a Leash Hitch on a fence
*/
public interface LeashHitch extends Hanging {
}

View File

@@ -369,4 +369,31 @@ public interface LivingEntity extends Entity, Damageable {
* @return if the custom name is displayed
*/
public boolean isCustomNameVisible();
/**
* Returns whether the entity is currently leashed.
*
* @return whether the entity is leashed
*/
public boolean isLeashed();
/**
* Gets the entity that is currently leading this entity.
*
* @return the entity holding the leash
* @throws IllegalStateException if not currently leashed
*/
public Entity getLeashHolder() throws IllegalStateException;
/**
* Sets the leash on this entity to be held by the supplied entity.
* <p>
* This method has no effect on EnderDragons, Withers, Players, or Bats.
* Non-living entities excluding leashes will not persist as leash
* holders.
*
* @param holder the entity to leash this entity to
* @return whether the operation was successful
*/
public boolean setLeashHolder(Entity holder);
}