Class PlayerDamageEvent
java.lang.Object
com.welcome234.pluginsystem.events.PlayerDamageEvent
Called when a player takes damage
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn enum used for player damage causes -
Constructor Summary
ConstructorsConstructorDescriptionPlayerDamageEvent(String playername, int damage, PlayerDamageEvent.DamageCause cause, int entityAttacker, String playerAttacker) -
Method Summary
Modifier and TypeMethodDescriptionGets the entity who attacked this player, or null if the damage was not caused by an entityGets the player who attacked this player, or null if the damage was not caused by a playerintGets the amount of damage this player has takenGets the cause of the damageGets the player who taken the damagebooleanGets whether this event is cancelledvoidsetCancelled(boolean cancelled)Sets the cancellation status of this event
-
Constructor Details
-
PlayerDamageEvent
public PlayerDamageEvent(String playername, int damage, PlayerDamageEvent.DamageCause cause, int entityAttacker, String playerAttacker)
-
-
Method Details
-
getPlayer
Gets the player who taken the damage- Returns:
- player instance
-
getDamageAmount
public int getDamageAmount()Gets the amount of damage this player has taken- Returns:
- Damage taken
-
getDamageCause
Gets the cause of the damage- Returns:
- Damage cause
-
getAttackerEntity
Gets the entity who attacked this player, or null if the damage was not caused by an entity- Returns:
- Entity instance
-
getAttackerPlayer
Gets the player who attacked this player, or null if the damage was not caused by a player- Returns:
- Player instance
-
isCancelled
public boolean isCancelled()Gets whether this event is cancelled- Returns:
- Whether cancelled
-
setCancelled
public void setCancelled(boolean cancelled)Sets the cancellation status of this event- Parameters:
cancelled- Whether cancelled
-