public class GamePlayerDeathEvent
extends GamePlayerEvent
public static com.github.lazoyoung.craftgames.event.GamePlayerDeathEvent.Companion Companion
public GamePlayerDeathEvent(@NotNull com.github.lazoyoung.craftgames.game.player.PlayerData playerData, @NotNull com.github.lazoyoung.craftgames.game.Game game, @NotNull org.bukkit.event.entity.PlayerDeathEvent bukkitEvent)
public boolean getCanRespawn()
Determines if this player can respawn or not.
Defaults to GameModule.setCanRespawn
GameModule.setCanRespawn
public void setCanRespawn(boolean p)
Determines if this player can respawn or not.
Defaults to GameModule.setCanRespawn
GameModule.setCanRespawn
public boolean getKeepInventory()
Decide to keep the items in inventory upon death.
public boolean getDropItems()
Decide to drop items on ground upon death.
@NotNull public org.bukkit.event.HandlerList getHandlers()
public void setCancelled(boolean cancel)
public boolean isCancelled()
@Nullable public org.bukkit.event.entity.EntityDamageEvent.DamageCause getCause()
Get the cause of this event.
@Nullable public org.bukkit.block.Block getKillerBlock()
Get the block which killed this player.
@Nullable public org.bukkit.entity.Entity getKillerEntity()
Get the entity who killed this player.
@NotNull public org.bukkit.Location getSpawnpoint()
@NotNull public Timer getRespawnTimer()
Get amount of time it takes to respawn this player.
public void setRewind(boolean rewind)
Decide if player should respawn back to the location where he/she died last time.
rewind
- If rewind
is true, previous death location becomes the new spawnpoint.Otherwise, spawnpoint would be reset to default one.public void setKeepInventory(boolean keep, boolean drop)
Decide if player's items should be kept upon death.
Defaults to GameModule.setKeepInventory
keep
- Whether or not to keep items in inventory.drop
- Whether or not to drop items on ground.IllegalArgumentException
- is thrown if keep
and drop
are both true.GameModule.setKeepInventory
public void setKeepExp(boolean keep, boolean drop)
Decide if player's experience level should be kept upon death.
public void setDeathMessage(@Nullable java.lang.String message)
Set death message to be announced upon death.
message
- The message (Pass null to remove it).public void setRespawnTimer(@NotNull Timer timer)
Set amount of time it takes to respawn this player.
Defaults to GameModule.setRespawnTimer
GameModule.setRespawnTimer
@JvmStatic @NotNull public static org.bukkit.event.HandlerList getHandlerList()