Class ArenaBedBreakEvent

java.lang.Object
org.bukkit.event.Event
de.marcely.bedwars.api.event.arena.ArenaBedBreakEvent
All Implemented Interfaces:
ArenaEvent

public class ArenaBedBreakEvent extends Event implements ArenaEvent
Gets called when a player breaks a bed during a game
  • Constructor Details

  • Method Details

    • getTeam

      public Team getTeam()
      Returns the team who own the bed.
      Returns:
      The team who own the bed
    • getBedLocation

      public ImmutableLocation getBedLocation()
      Returns the location of the broken bed.
      Returns:
      The location of the broken bed
    • getCause

      public BedDestructionInfo.Cause getCause()
      Returns the specific cause of the bed destruction.
      Returns:
      The cause or action of the bed destruction
    • getResult

      public ArenaBedBreakEvent.Result getResult()
      Returns what shall happen after the event.
      Returns:
      The result of the event
    • setResult

      public void setResult(ArenaBedBreakEvent.Result result)
      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:
      true if 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 - true if a message shall be sent to all players
      See Also:
    • getChatMessageFunction

      public Function<Player,Message> 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

      public void setChatMessageFunction(Function<Player,Message> function)
      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

      public void setChatMessage(Message message)
      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 case isSendingChatMessage() returns false.

      Parameters:
      message - The new message
    • isSendingTitle

      public boolean isSendingTitle()
      Get whether a title message shall be sent.
      Returns:
      true if 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 - true if 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

      @Nullable public @Nullable Player 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 null when there isn't one
    • getAltDisplayName

      public String 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

      public void setAltDisplayName(String altDisplayName)
      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

      public HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getHandlerList

      public static HandlerList getHandlerList()