Class PlayerTriggerUpgradeEvent

java.lang.Object
org.bukkit.event.Event
de.marcely.bedwars.api.event.player.PlayerTriggerUpgradeEvent
All Implemented Interfaces:
ArenaEvent, Cancellable

public class PlayerTriggerUpgradeEvent extends Event implements ArenaEvent, Cancellable
Gets called when an upgrade is bought (and thus automatically triggered) or a trap is triggered.
  • Constructor Details

    • PlayerTriggerUpgradeEvent

      public PlayerTriggerUpgradeEvent(Player player, Arena arena, Team team, UpgradeLevel upgradeLevel, boolean broadcastingMessage, boolean broadcastingTitle, boolean broadcastingSound, boolean takingFromQueue)
    • PlayerTriggerUpgradeEvent

      public PlayerTriggerUpgradeEvent(@Nullable @Nullable Player player, Arena arena, Team team, UpgradeLevel upgradeLevel)
  • Method Details

    • getPlayer

      @Nullable public @Nullable Player getPlayer()
      Returns the player that triggered the upgrade or trap.

      It can be null if the upgrade was triggered using the API.

      Returns:
      The player that triggered the upgrade or trap. May be null
      See Also:
    • hasPlayer

      public boolean hasPlayer()
      Get whether any player triggered the upgrade or trap.

      This may be false if the upgrade was triggered using the API.

      Returns:
      true if there is a known player that triggered the upgrade or trap
      See Also:
    • getArena

      public Arena getArena()
      Returns the arena in which the trap was triggered.
      Specified by:
      getArena in interface ArenaEvent
      Returns:
      The arena involved
    • getTeam

      public Team getTeam()
      Returns the team in which the upgrade or trap belongs to.
      Returns:
      The team involved
    • isAPICall

      public boolean isAPICall()
      Get whether this upgrade was virtually done using the API.
      Returns:
      true if an addon triggered. false if a player himself triggered it
      See Also:
    • isTakingFromQueue

      public boolean isTakingFromQueue()
      If true the trap will be pulled from the upgrade queue. This has no effect if this UpgradeLevel handler is not a trap
      Returns:
      weather or not a trap will be pulled from the team's trap queue
    • setTakingFromQueue

      public void setTakingFromQueue(boolean takingFromQueue)
      If true the trap will be pulled from the upgrade queue. This has no effect if this UpgradeLevel handler is not a trap
      Parameters:
      takingFromQueue - weather or not a trap will be pulled from the team's trap queue
    • isBroadcastingMessage

      public boolean isBroadcastingMessage()
      Whether or not a message will be sent out to all team players when an upgrade is purchased, or when a trap is triggered
      Returns:
      if a message will be broadcast
    • setBroadcastingMessage

      public void setBroadcastingMessage(boolean broadcastingMessage)
      Sets whether or not a message will be sent out to all team players when an upgrade is purchased, or when a trap is triggered
      Parameters:
      broadcastingMessage - if a message should be broadcast
    • isBroadcastingTitle

      public boolean isBroadcastingTitle()
      Whether or not a title will be sent out to all team players when an upgrade is purchased, or when a trap is triggered
      Returns:
      if a title will be sent
    • setBroadcastingTitle

      public void setBroadcastingTitle(boolean broadcastingTitle)
      Sets whether or not a title will be sent out to all team players when an upgrade is purchased, or when a trap is triggered
      Parameters:
      broadcastingTitle - if a message should be broadcast
    • isBroadcastingSound

      public boolean isBroadcastingSound()
      Whether or not a sound will be played when an upgrade is purchased, or when a trap is triggered
      Returns:
      if the sound is being played
    • setBroadcastingSound

      public void setBroadcastingSound(boolean broadcastingSound)
      Set whether or not a sound should be played when an upgrade is purchased, or when a trap is triggered
      Parameters:
      broadcastingSound - if the sound should be played
    • getUpgradeLevel

      public UpgradeLevel getUpgradeLevel()
      Returns the UpgradeLevel that belongs to the upgrade that's being triggered, or the trap that's being purchased
      Returns:
      UpgradeLevel that's being triggered
    • getAmplifier

      public double getAmplifier()
      Returns the amplifier that's being applied to this upgrade
      Returns:
      the amplifier for the upgrade level being triggered
    • getDuration

      public int getDuration()
      Returns the duration that's being applied to this upgrade
      Returns:
      the duration for the upgrade level being triggered
    • isTrap

      public boolean isTrap()
      Returns if the handler attached to this UpgradeLevel is a trap handler
      Returns:
      check if the upgrade level that was purchased is a trap
    • getHandlers

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

      public static HandlerList getHandlerList()