public class PlayerDamageEvent extends PlayerEvent implements Cancellable
| Modifier and Type | Class and Description |
|---|---|
static class |
PlayerDamageEvent.Cause
Determines why the
PlayerDamageEvent was triggered exactly
(i.e. what's causing the damage). |
| Constructor and Description |
|---|
PlayerDamageEvent(Player player,
short damage,
int previousHealth,
PlayerDamageEvent.Cause cause) |
| Modifier and Type | Method and Description |
|---|---|
PlayerDamageEvent.Cause |
getCause()
Gets the "cause" of this damage, i.e. the reason why the player takes damage
(or in other words, what's causing the damage)
|
short |
getDamage()
Gets the amount of damage the player will receive.
|
int |
getPreviousHealth()
Gets the previous amount of health.
|
boolean |
isCancelled()
Determines if the event is cancelled.
|
void |
setCancelled(boolean cancel)
Cancels this event.
|
void |
setDamage(short damage)
Sets the amount of damage the player will receive.
|
getPlayerpublic PlayerDamageEvent(Player player, short damage, int previousHealth, PlayerDamageEvent.Cause cause)
public void setDamage(short damage)
damage - the new damage amount.public short getDamage()
public int getPreviousHealth()
public PlayerDamageEvent.Cause getCause()
public boolean isCancelled()
CancellableisCancelled in interface Cancellablepublic void setCancelled(boolean cancel)
CancellablesetCancelled in interface Cancellablecancel - set to true if you want to cancel this event.