All entity stuff in org.bukkit moved to org.bukkit.entity

By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
Bukkit/Spigot
2011-01-15 21:20:59 +00:00
parent 79b2b7fc32
commit e2fd2dfd00
46 changed files with 282 additions and 257 deletions

View File

@@ -0,0 +1,9 @@
package org.bukkit.entity;
/**
* Represents an arrow.
*
* @author sk89q
*/
public interface Arrow extends Entity {
}

View File

@@ -0,0 +1,9 @@
package org.bukkit.entity;
/**
* Represents a boat entity.
*
* @author sk89q
*/
public interface Boat extends Vehicle {
}

View File

@@ -0,0 +1,9 @@
package org.bukkit.entity;
/**
* Represents an egg.
*
* @author sk89q
*/
public interface Egg extends Entity {
}

View File

@@ -0,0 +1,45 @@
package org.bukkit.entity;
import org.bukkit.Location;
import org.bukkit.World;
/**
* Represents a base entity in the world
*/
public interface Entity {
/**
* Gets the entitys current position
*
* @return Location containing the position of this entity
*/
public Location getLocation();
/**
* Gets the current world this entity resides in
*
* @return World
*/
public World getWorld();
/**
* Teleports this entity to the given location
*
* @param location New location to teleport this entity to
*/
public void teleportTo(Location location);
/**
* Teleports this entity to the target Entity
*
* @param destination Entity to teleport this entity to
*/
public void teleportTo(Entity destination);
/**
* Returns a unique id for this entity
*
* @return Entity id
*/
public int getEntityId();
}

View File

@@ -0,0 +1,49 @@
package org.bukkit.entity;
import org.bukkit.ItemStack;
import org.bukkit.PlayerInventory;
/**
* Represents a human entity, such as an NPC or a player
*/
public interface HumanEntity extends LivingEntity {
/**
* Returns the name of this player
*
* @return Player name
*/
public String getName();
/**
* Get the player's inventory.
*
* @return The inventory of the player, this also contains the armor slots.
*/
public PlayerInventory getInventory();
/**
* Returns the ItemStack currently in your hand, can be empty.
*
* @return The ItemStack of the item you are currently holding.
*/
public ItemStack getItemInHand();
/** TODO: This probably won't work ;(
* Sets the item to the given ItemStack, this will replace whatever the
* user was holding.
*
* @param item The ItemStack which will end up in the hand
* @return
*
public void setItemInHand( ItemStack item );
**
* Changes the item in hand to another of your 'action slots'.
*
* @param index The new index to use, only valid ones are 0-8.
*
public void selectItemInHand( int index );
*/
}

View File

@@ -0,0 +1,17 @@
package org.bukkit.entity;
import org.bukkit.ItemStack;
/**
* Represents a dropped item.
*
* @author sk89q
*/
public interface ItemDrop extends Entity {
/**
* Gets the item stack.
*
* @return
*/
public ItemStack getItemStack();
}

View File

@@ -0,0 +1,62 @@
package org.bukkit.entity;
/**
* Represents a living entity, such as a monster or player
*/
public interface LivingEntity extends Entity {
/**
* Gets the entitys health from 0-20, where 0 is dead and 20 is full
*
* @return Health represented from 0-20
*/
public int getHealth();
/**
* Sets the entitys health from 0-20, where 0 is dead and 20 is full
*
* @param health New health represented from 0-20
*/
public void setHealth(int health);
/**
* Throws an egg from the entity.
*/
public Egg throwEgg();
/**
* Throws a snowball from the entity.
*/
public Snowball throwSnowball();
/**
* Shoots an arrow from the entity.
*
* @return
*/
public Arrow shootArrow();
/**
* Returns whether this entity is inside a vehicle.
*
* @return
*/
public boolean isInsideVehicle();
/**
* Leave the current vehicle. If the entity is currently in a vehicle
* (and is removed from it), true will be returned, otherwise false will
* be returned.
*
* @return
*/
public boolean leaveVehicle();
/**
* Get the vehicle that this player is inside. If there is no vehicle,
* null will be returned.
*
* @return
*/
public Vehicle getVehicle();
}

View File

@@ -0,0 +1,22 @@
package org.bukkit.entity;
/**
* Represents a minecart entity.
*
* @author sk89q
*/
public interface Minecart extends Vehicle {
/**
* Sets a minecart's damage.
*
* @param damage over 40 to "kill" a minecart
*/
public void setDamage(int damage);
/**
* Gets a minecart's damage.
*
* @param damage
*/
public int getDamage();
}

View File

@@ -0,0 +1,25 @@
package org.bukkit.entity;
public enum MobType {
CHICKEN("Chicken"),
COW("Cow"),
CREEPER("Creeper"),
GHAST("Ghast"),
PIG("Pig"),
PIG_ZOMBIE("PigZombie"),
SHEEP("Sheep"),
SKELETON("Skeleton"),
SPIDER("Spider"),
ZOMBIE("Zombie");
private String name;
private MobType(String name) {
this.name = name;
}
public String getName() {
return name;
}
}

View File

@@ -0,0 +1,57 @@
package org.bukkit.entity;
import java.net.InetSocketAddress;
/**
* Represents a player, connected or not
*
*/
public interface Player extends HumanEntity {
/**
* Checks if this player is currently online
*
* @return true if they are online
*/
public boolean isOnline();
/**
* Sends this player a message, which will be displayed in their chat
*
* @param message Message to be displayed
*/
public void sendMessage(String message);
/**
* Gets the "friendly" name to display of this player. This may include color.
*
* Note that this name will not be displayed in game, only in chat and places
* defined by plugins
*
* @return String containing a color formatted name to display for this player
*/
public String getDisplayName();
/**
* Sets the "friendly" name to display of this player. This may include color.
*
* Note that this name will not be displayed in game, only in chat and places
* defined by plugins
*
* @return String containing a color formatted name to display for this player
*/
public void setDisplayName(String name);
/**
* Gets the socket address of this player
* @return the player's address
*/
public InetSocketAddress getAddress();
/**
* Kicks player with custom kick message.
*
* @return
*/
public void kickPlayer(String message);
}

View File

@@ -0,0 +1,10 @@
package org.bukkit.entity;
/**
* Represents a powered minecart.
*
* @author sk89q
*/
public interface PoweredMinecart extends Minecart {
}

View File

@@ -0,0 +1,9 @@
package org.bukkit.entity;
/**
* Implements a snowball.
*
* @author sk89q
*/
public interface Snowball extends Entity {
}

View File

@@ -0,0 +1,17 @@
package org.bukkit.entity;
import org.bukkit.Inventory;
/**
* Represents a storage minecart.
*
* @author sk89q
*/
public interface StorageMinecart extends Minecart {
/**
* Return the inventory object for this StorageMinecart.
*
* @return The inventory for this Minecart
*/
public Inventory getInventory();
}

View File

@@ -0,0 +1,54 @@
package org.bukkit.entity;
import org.bukkit.Vector;
/**
* Represents a vehicle entity.
*
* @author sk89q
*/
public interface Vehicle extends Entity {
/**
* Gets the vehicle's velocity.
*
* @return velocity vector
*/
public Vector getVelocity();
/**
* Sets the vehicle's velocity.
*
* @param vel velocity vector
*/
public void setVelocity(Vector vel);
/**
* Gets the primary passenger of a vehicle. For vehicles that could have
* multiple passengers, this will only return the primary passenger.
*
* @return an entity
*/
public Entity getPassenger();
/**
* Set the passenger of a vehicle.
*
* @param passenger
* @return false if it could not be done for whatever reason
*/
public boolean setPassenger(Entity passenger);
/**
* Returns true if the vehicle has no passengers.
*
* @return
*/
public boolean isEmpty();
/**
* Eject any passenger. True if there was a passenger.
*
* @return
*/
public boolean eject();
}