Class ArenaBedBreakEvent
java.lang.Object
org.bukkit.event.Event
de.marcely.bedwars.api.event.arena.ArenaBedBreakEvent
- All Implemented Interfaces:
ArenaEvent
Gets called when a player breaks a bed during a game
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumUse it to declare what's supposed to happen next. -
Constructor Summary
ConstructorsConstructorDescriptionArenaBedBreakEvent(Arena arena, @Nullable Player player, String altDisplayName, Team team, Location bedLocation, BedDestructionInfo.Cause cause, ArenaBedBreakEvent.Result result, boolean playSound, boolean sendTitle, boolean sendMessage, Function<Player, Message> messageFunction) -
Method Summary
Modifier and TypeMethodDescriptionWill show this to the player as the cause that broke the bed.Returns the location of the broken bed.getCause()Returns the specific cause of the bed destruction.Get the function that is used to obtain the message that shall be sent to each player.static HandlerList@Nullable PlayerReturns the player who broke the bed.Returns what shall happen after the event.getTeam()Returns the team who own the bed.booleanIt's possible that beds get broken without the influence of a player.booleanWhether the bed break sound is being played.booleanGet whether a chat message shall be sent.booleanGet whether a title message shall be sent.voidsetAltDisplayName(String altDisplayName) Will show this to the player as the cause that broke the bed.voidsetChatMessage(Message message) Set a constant message that is equal for all players.voidsetChatMessageFunction(Function<Player, Message> function) Set the function that is used to obtain the message that shall be sent to each player.voidsetPlayingSound(boolean playSound) Define whether the bed break sound shall be played.voidsetResult(ArenaBedBreakEvent.Result result) Set what should happen after the event.voidsetSendingChatMessage(boolean sendMessage) Define whether a chat message shall be sent.voidsetSendingTitle(boolean sendTitle) Define whether a title message shall be sent.Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronousMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.marcely.bedwars.api.event.arena.ArenaEvent
getArena
-
Constructor Details
-
ArenaBedBreakEvent
public ArenaBedBreakEvent(Arena arena, @Nullable @Nullable Player player, String altDisplayName, Team team, Location bedLocation, BedDestructionInfo.Cause cause, ArenaBedBreakEvent.Result result, boolean playSound, boolean sendTitle, boolean sendMessage, Function<Player, Message> messageFunction)
-
-
Method Details
-
getTeam
Returns the team who own the bed.- Returns:
- The team who own the bed
-
getBedLocation
Returns the location of the broken bed.- Returns:
- The location of the broken bed
-
getCause
Returns the specific cause of the bed destruction.- Returns:
- The cause or action of the bed destruction
-
getResult
Returns what shall happen after the event.- Returns:
- The result of the event
-
setResult
Set what should happen after the event.- Parameters:
result- The new result
-
isSendingChatMessage
public boolean isSendingChatMessage()Get whether a chat message shall be sent.- Returns:
trueif a message shall be sent to all players- See Also:
-
setSendingChatMessage
public void setSendingChatMessage(boolean sendMessage) Define whether a chat message shall be sent.- Parameters:
sendMessage-trueif a message shall be sent to all players- See Also:
-
getChatMessageFunction
Get the function that is used to obtain the message that shall be sent to each player.Note that it's not being used in case
isSendingChatMessage()returns false.- Returns:
- A function that is used for the chat message process
-
setChatMessageFunction
Set the function that is used to obtain the message that shall be sent to each player.Note that it's not being used in case
isSendingChatMessage()returns false.- Parameters:
function- A function that is used for the chat message process
-
setChatMessage
Set a constant message that is equal for all players.Basically calls
setChatMessageFunction(Function)with a non-upcyable message instance. Note that it's not being used in caseisSendingChatMessage()returns false.- Parameters:
message- The new message
-
isSendingTitle
public boolean isSendingTitle()Get whether a title message shall be sent.- Returns:
trueif a title shall be sent to all players- See Also:
-
setSendingTitle
public void setSendingTitle(boolean sendTitle) Define whether a title message shall be sent.- Parameters:
sendTitle-trueif a title shall be sent to all players- See Also:
-
isPlayingSound
public boolean isPlayingSound()Whether the bed break sound is being played.- Returns:
- If the event is plying the bed break sound.
-
setPlayingSound
public void setPlayingSound(boolean playSound) Define whether the bed break sound shall be played.- Parameters:
playSound- Whether the bed break sound shall be played.
-
isPlayerCaused
public boolean isPlayerCaused()It's possible that beds get broken without the influence of a player. E.g. a plugin or a creeper could've broken the bed. Use this method to check whether if effectively the player caused for the bed to get broken.- Returns:
- Whether a player has caused the bed to get broken
-
getPlayer
Returns the player who broke the bed.Keep in mind that it doesn't always have to be a player who broke the bed. E.g. a plugin or a creeper could've broken the bed. In this case it'll return null. Use
isPlayerCaused()to check whether there's a player who caused this to happen.- Returns:
- The player who broke the bed or
nullwhen there isn't one
-
getAltDisplayName
Will show this to the player as the cause that broke the bed. Priorities this over the player's name (if there's even one).- Returns:
- The name of the cause
-
setAltDisplayName
Will show this to the player as the cause that broke the bed. Priorities this over the player's name (if there's even one).- Parameters:
altDisplayName- The new name for the cause
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getHandlerList
-