Package org.bukkit.entity
Interface Damageable
- All Superinterfaces:
CommandSender
,Entity
,Metadatable
,Permissible
,ServerOperator
- All Known Subinterfaces:
Ageable
,Ambient
,Animals
,ArmorStand
,Bat
,Blaze
,CaveSpider
,Chicken
,ComplexLivingEntity
,Cow
,Creature
,Creeper
,EnderDragon
,EnderDragonPart
,Enderman
,Endermite
,Flying
,Ghast
,Giant
,Golem
,Guardian
,Horse
,HumanEntity
,IronGolem
,LivingEntity
,MagmaCube
,Monster
,MushroomCow
,NPC
,Ocelot
,Pig
,PigZombie
,Player
,Rabbit
,Sheep
,Silverfish
,Skeleton
,Slime
,Snowman
,Spider
,Squid
,Villager
,WaterMob
,Witch
,Wither
,Wolf
,Zombie
Represents an
Entity
that has health and can take damage.-
Method Summary
Modifier and TypeMethodDescriptionvoid
_INVALID_damage
(int amount) Deprecated.void
_INVALID_damage
(int amount, Entity source) Deprecated.int
Deprecated.int
Deprecated.void
_INVALID_setHealth
(int health) Deprecated.void
_INVALID_setMaxHealth
(int health) Deprecated.void
damage
(double amount) Deals the given amount of damage to this entity.void
Deals the given amount of damage to this entity, from a specified entity.double
Gets the entity's health from 0 togetMaxHealth()
, where 0 is dead.double
Gets the maximum health this entity has.void
Resets the max health to the original amount.void
setHealth
(double health) Sets the entity's health from 0 togetMaxHealth()
, where 0 is dead.void
setMaxHealth
(double health) Sets the maximum health this entity can have.Methods inherited from interface org.bukkit.command.CommandSender
getName, sendMessage, sendMessage
Methods inherited from interface org.bukkit.entity.Entity
eject, getCustomName, getEntityId, getFallDistance, getFireTicks, getLastDamageCause, getLocation, getLocation, getMaxFireTicks, getNearbyEntities, getPassenger, getServer, getTicksLived, getType, getUniqueId, getVehicle, getVelocity, getWorld, isCustomNameVisible, isDead, isEmpty, isInsideVehicle, isOnGround, isValid, leaveVehicle, playEffect, remove, setCustomName, setCustomNameVisible, setFallDistance, setFireTicks, setLastDamageCause, setPassenger, setTicksLived, setVelocity, teleport, teleport, teleport, teleport
Methods inherited from interface org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
Methods inherited from interface org.bukkit.permissions.Permissible
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachment
Methods inherited from interface org.bukkit.permissions.ServerOperator
isOp, setOp
-
Method Details
-
damage
void damage(double amount) Deals the given amount of damage to this entity.- Parameters:
amount
- Amount of damage to deal
-
_INVALID_damage
Deprecated.This method exists for legacy reasons to provide backwards compatibility. It will not exist at runtime and should not be used under any circumstances.- Parameters:
amount
- Amount of damage to deal
-
damage
Deals the given amount of damage to this entity, from a specified entity.- Parameters:
amount
- Amount of damage to dealsource
- Entity which to attribute this damage from
-
_INVALID_damage
Deprecated.This method exists for legacy reasons to provide backwards compatibility. It will not exist at runtime and should not be used under any circumstances.- Parameters:
amount
- Amount of damage to dealsource
- Entity which to attribute this damage from
-
getHealth
double getHealth()Gets the entity's health from 0 togetMaxHealth()
, where 0 is dead.- Returns:
- Health represented from 0 to max
-
_INVALID_getHealth
Deprecated.This method exists for legacy reasons to provide backwards compatibility. It will not exist at runtime and should not be used under any circumstances.- Returns:
- Health represented from 0 to max
-
setHealth
void setHealth(double health) Sets the entity's health from 0 togetMaxHealth()
, where 0 is dead.- Parameters:
health
- New health represented from 0 to max- Throws:
IllegalArgumentException
- Thrown if the health is < 0 or >getMaxHealth()
-
_INVALID_setHealth
Deprecated.This method exists for legacy reasons to provide backwards compatibility. It will not exist at runtime and should not be used under any circumstances.- Parameters:
health
- New health represented from 0 to max- Throws:
IllegalArgumentException
- Thrown if the health is < 0 or >getMaxHealth()
-
getMaxHealth
double getMaxHealth()Gets the maximum health this entity has.- Returns:
- Maximum health
-
_INVALID_getMaxHealth
Deprecated.This method exists for legacy reasons to provide backwards compatibility. It will not exist at runtime and should not be used under any circumstances.- Returns:
- Maximum health
-
setMaxHealth
void setMaxHealth(double health) Sets the maximum health this entity can have.If the health of the entity is above the value provided it will be set to that value.
Note: An entity with a health bar (
Player
,EnderDragon
,Wither
, etc...} will have their bar scaled accordingly.- Parameters:
health
- amount of health to set the maximum to
-
_INVALID_setMaxHealth
Deprecated.This method exists for legacy reasons to provide backwards compatibility. It will not exist at runtime and should not be used under any circumstances.- Parameters:
health
- amount of health to set the maximum to
-
resetMaxHealth
void resetMaxHealth()Resets the max health to the original amount.
-