Add leash API. Adds BUKKIT-4459 and BUKKIT-4583
By: T00thpick1 <t00thpick1dirko@gmail.com>
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
/**
|
||||
* Represents a Leash Hitch on a fence
|
||||
*/
|
||||
public interface LeashHitch extends Hanging {
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user