Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
Damageable.java
1 package org.bukkit.entity;
2 
3 /**
4  * Represents an {@link Entity} that has health and can take damage.
5  */
6 public interface Damageable extends Entity {
7  /**
8  * Deals the given amount of damage to this entity.
9  *
10  * @param amount Amount of damage to deal
11  */
12  void damage(double amount);
13 
14  /**
15  * This method exists for legacy reasons to provide backwards
16  * compatibility. It will not exist at runtime and should not be used
17  * under any circumstances.
18  */
19  @Deprecated
20  void _INVALID_damage(int amount);
21 
22  /**
23  * Deals the given amount of damage to this entity, from a specified
24  * entity.
25  *
26  * @param amount Amount of damage to deal
27  * @param source Entity which to attribute this damage from
28  */
29  void damage(double amount, Entity source);
30 
31  /**
32  * This method exists for legacy reasons to provide backwards
33  * compatibility. It will not exist at runtime and should not be used
34  * under any circumstances.
35  */
36  @Deprecated
37  void _INVALID_damage(int amount, Entity source);
38 
39  /**
40  * Gets the entity's health from 0 to {@link #getMaxHealth()}, where 0 is dead.
41  *
42  * @return Health represented from 0 to max
43  */
44  double getHealth();
45 
46  /**
47  * This method exists for legacy reasons to provide backwards
48  * compatibility. It will not exist at runtime and should not be used
49  * under any circumstances.
50  */
51  @Deprecated
52  int _INVALID_getHealth();
53 
54  /**
55  * Sets the entity's health from 0 to {@link #getMaxHealth()}, where 0 is
56  * dead.
57  *
58  * @param health New health represented from 0 to max
59  * @throws IllegalArgumentException Thrown if the health is < 0 or >
60  * {@link #getMaxHealth()}
61  */
62  void setHealth(double health);
63 
64  /**
65  * This method exists for legacy reasons to provide backwards
66  * compatibility. It will not exist at runtime and should not be used
67  * under any circumstances.
68  */
69  @Deprecated
70  void _INVALID_setHealth(int health);
71 
72  /**
73  * Gets the maximum health this entity has.
74  *
75  * @return Maximum health
76  */
77  double getMaxHealth();
78 
79  /**
80  * This method exists for legacy reasons to provide backwards
81  * compatibility. It will not exist at runtime and should not be used
82  * under any circumstances.
83  */
84  @Deprecated
86 
87  /**
88  * Sets the maximum health this entity can have.
89  * <p>
90  * If the health of the entity is above the value provided it will be set
91  * to that value.
92  * <p>
93  * Note: An entity with a health bar ({@link Player}, {@link EnderDragon},
94  * {@link Wither}, etc...} will have their bar scaled accordingly.
95  *
96  * @param health amount of health to set the maximum to
97  */
98  void setMaxHealth(double health);
99 
100  /**
101  * This method exists for legacy reasons to provide backwards
102  * compatibility. It will not exist at runtime and should not be used
103  * under any circumstances.
104  */
105  @Deprecated
106  void _INVALID_setMaxHealth(int health);
107 
108  /**
109  * Resets the max health to the original amount.
110  */
111  void resetMaxHealth();
112 }
void _INVALID_setHealth(int health)
void _INVALID_damage(int amount)
void setHealth(double health)
void damage(double amount)
void setMaxHealth(double health)
void _INVALID_setMaxHealth(int health)