AnimalTamer and Tameable interfaces, and corresponding features.

Documentation improvements.
This commit is contained in:
Andrew Ardill 2011-05-03 00:36:02 +10:00
parent 18b3a7a919
commit daaf0aa6a9
4 changed files with 48 additions and 30 deletions

View File

@ -0,0 +1,5 @@
package org.bukkit.entity;
public interface AnimalTamer {
}

View File

@ -7,7 +7,7 @@ import org.bukkit.inventory.PlayerInventory;
/**
* Represents a human entity, such as an NPC or a player
*/
public interface HumanEntity extends LivingEntity {
public interface HumanEntity extends LivingEntity, AnimalTamer {
/**
* Returns the name of this player
*

View File

@ -0,0 +1,39 @@
package org.bukkit.entity;
public interface Tameable {
/**
* Check if this is tamed
*
* If something is tamed then a player can not tame it through normal methods, even if it does not belong to anyone in particular.
*
* @return true if this has been tamed
*/
public boolean isTamed();
/**
* Sets if this has been tamed. Not necessary if the method setOwner has been used, as it tames automatically.
*
* If something is tamed then a player can not tame it through normal methods, even if it does not belong to anyone in particular.
*
* @param tame true if tame
*/
public void setTamed(boolean tame);
/**
* Gets the current owning AnimalTamer
*
* @return the owning AnimalTamer, or null if not owned
*/
public AnimalTamer getOwner();
/**
* Set this to be owned by given AnimalTamer.
* If the owner is not null, this will be tamed and will have any current path it is following removed.
* If the owner is set to null, this will be untamed, and the current owner removed.
*
* @param tamer the AnimalTamer who should own this
*/
public void setOwner(AnimalTamer tamer);
}

View File

@ -4,7 +4,7 @@ package org.bukkit.entity;
/**
* Represents a Wolf
*/
public interface Wolf extends Animals {
public interface Wolf extends Animals, Tameable {
/**
* Checks if this wolf is angry
*
@ -14,6 +14,7 @@ public interface Wolf extends Animals {
/**
* Sets the anger of this wolf
* An angry wolf can not be fed or tamed, and will actively look for targets to attack.
*
* @param angry true if angry
*/
@ -28,37 +29,10 @@ public interface Wolf extends Animals {
/**
* Sets if this wolf is sitting
* Will remove any path that the wolf was following beforehand.
*
* @param sitting true if sitting
*/
public void setSitting(boolean sitting);
/**
* Check if this wolf is tame
*
* @return true if tame
*/
public boolean isTame();
/**
* Sets if wolf is tame
*
* @param tame true if tame
*/
public void setTame(boolean tame);
/**
* Gets the name of the current owning player
*
* @return owners name, "" or null if unowned
*/
public String getOwner();
/**
* Set the wolf to be owned by given player (also is tamed)
*
* @param player name of owner, or null/"" if setting to unowned
*/
public void setOwner(String player);
}