Class PlayerIngameDeathEvent
- All Implemented Interfaces:
ArenaEvent
- Direct Known Subclasses:
PlayerKillPlayerEvent
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result -
Field Summary
Fields inherited from class org.bukkit.event.player.PlayerEvent
player -
Constructor Summary
ConstructorsConstructorDescriptionPlayerIngameDeathEvent(PlayerDeathEvent bukkitEvent, Arena arena, boolean fatalDeath, Message deathMessage, Set<Player> deathMessageTargets, int deathSpectateDuration) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddDeathMessageTarget(Player player) Add a player to whom the custom death message will be displayed to.booleanaddDeathMessageTargets(Collection<? extends Player> players) Add multiple players simultaneously to whom the custom death message will be displayed to.getArena()Returns the arena in which the player has died.Returns the event that got everything rolling and that has been used to identify the players death.Returns the death message that'll be displayed in the chat to the players instead of the default vanilla one.Returns all the players to whom the custom death message will be displayed to.intReturns the duration in seconds in which the player will enter the spectator mode after his respawn.static HandlerListbooleanReturns whether the player will have to wait by spectating.booleanReturns whether or not the player is getting excluded due his death.booleanremoveDeathMessageTarget(Player player) Remove a player to whom the custom death message shall not be displayed to.booleanremoveDeathMessageTargets(Collection<? extends Player> players) Remove players to whom the custom death message shall not be displayed to.voidsetDeathMessage(Message deathMessage) Set the death message that'll be displayed in the chat to the players instead of the default vanilla one.voidsetDeathSpectateDuration(int duration) Set the duration in seconds in which the player will enter the spectator mode after his respawn.voidsetFatalDeath(boolean fatalDeath) Set whether the player shall get excluded due his death.Methods inherited from class org.bukkit.event.player.PlayerEvent
getPlayerMethods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
Constructor Details
-
PlayerIngameDeathEvent
public PlayerIngameDeathEvent(PlayerDeathEvent bukkitEvent, Arena arena, boolean fatalDeath, Message deathMessage, Set<Player> deathMessageTargets, int deathSpectateDuration)
-
-
Method Details
-
getBukkitEvent
Returns the event that got everything rolling and that has been used to identify the players death.- Returns:
- The event that contains deeper info about the players death
-
getArena
Returns the arena in which the player has died.- Specified by:
getArenain interfaceArenaEvent- Returns:
- The involved arena
-
isFatalDeath
public boolean isFatalDeath()Returns whether or not the player is getting excluded due his death.- Returns:
- If his death was fatal or not
-
setFatalDeath
public void setFatalDeath(boolean fatalDeath) Set whether the player shall get excluded due his death.- Parameters:
fatalDeath- If his death was fatal or not
-
getDeathMessage
Returns the death message that'll be displayed in the chat to the players instead of the default vanilla one.This method never returns
null. It might return an empty String with theString.length()of 0. In this case it won't display any death message to him.
Make sure to not free the Message instance! Otherwise you might face an unexpected behaviour.- Returns:
- The death message of his death
-
setDeathMessage
Set the death message that'll be displayed in the chat to the players instead of the default vanilla one.Pass in an empty string (has a
String.length()of 0). In this case it won't display any death message.- Parameters:
deathMessage- The new death message of his death
-
getDeathMessageTargets
Returns all the players to whom the custom death message will be displayed to.This calculates it for all players on the server and not only for those inside the arena. It's legal to modify the entries of the returning Collection.
- Returns:
- All players (on the server) to whom the death message will be shown
-
addDeathMessageTarget
Add a player to whom the custom death message will be displayed to.You may add any player on the server. This does not only count for the players on the server. Using
getDeathMessageTargets()#add(player) is also legal.- Parameters:
player- The player who shall be added- Returns:
falseif he's already receiving it, otherwisetrue
-
addDeathMessageTargets
Add multiple players simultaneously to whom the custom death message will be displayed to.You may add any player on the server. This does not only count for the players on the server. Using
getDeathMessageTargets()#add(players) is also legal.- Parameters:
players- The players who shall be added- Returns:
trueif at least one player has been newly added
-
removeDeathMessageTarget
Remove a player to whom the custom death message shall not be displayed to.You may remove any player on the server. This does not only count for the players on the server. Using
getDeathMessageTargets()#remove(player) is also legal.- Parameters:
player- The player who shall be removed- Returns:
falseif he hasn't already been receiving it, otherwisetrue
-
removeDeathMessageTargets
Remove players to whom the custom death message shall not be displayed to.You may remove any player on the server. This does not only count for the players on the server. Using
getDeathMessageTargets()#remove(players) is also legal.- Parameters:
players- The players who shall be removed- Returns:
trueif at least one player has been removed
-
getDeathSpectateDuration
public int getDeathSpectateDuration()Returns the duration in seconds in which the player will enter the spectator mode after his respawn. He has to wait this duration until he's able to respawn again.This returning 0 or less causes him to get respawned immediately.
- Returns:
- The duration in seconds he'll have to wait until he respawns.
-1to make him respawn immediately
-
setDeathSpectateDuration
public void setDeathSpectateDuration(int duration) Set the duration in seconds in which the player will enter the spectator mode after his respawn. He has to wait this duration until he's able to respawn again.Setting this to 0 or less causes him to get respawned immediately.
- Parameters:
duration- Set the duration in seconds he'll have to wait until he respawns.-1to make him respawn immediately
-
isDeathSpectating
public boolean isDeathSpectating()Returns whether the player will have to wait by spectating.Use
setDeathSpectateDuration(int)to modify the behaviour.- Returns:
- Whether he'll have to wait to respawn or not
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getHandlerList
-