Class PerkLimitReachedEvent

java.lang.Object
org.bukkit.event.Event
dev.itsharshxd.zentrix.api.events.ZentrixEvent
dev.itsharshxd.zentrix.api.events.perk.PerkLimitReachedEvent

public final class PerkLimitReachedEvent extends ZentrixEvent
Called when a perk limit stops a player: hosting one more custom game than their tier allows, making a private game, inviting someone to a full party, using the team changer.

The action has already been refused; the player is sent the limit message from locales/en.yml after this event, naming getNextTier() when there is one. A shop plugin can offer that tier, and may suppress the message to send its own.

Main thread; only fired while a listener is registered.

Since:
1.9.0
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.bukkit.event.Event

    org.bukkit.event.Event.Result
  • Constructor Summary

    Constructors
    Constructor
    Description
    PerkLimitReachedEvent(@NotNull org.bukkit.entity.Player player, @NotNull Perk perk, int limit, @Nullable PerkTier currentTier, @Nullable PerkTier nextTier)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull Optional<PerkTier>
    The tier the player belongs to, or empty when they hold none.
    static @NotNull org.bukkit.event.HandlerList
     
    @NotNull org.bukkit.event.HandlerList
    Gets the handler list for this event.
    int
    The player's value of a Perk.Type.NUMBER perk, which they reached; 0 for a toggle perk they are not allowed.
    @NotNull Optional<PerkTier>
    The lowest tier above theirs that would allow the action, or empty when none would.
    @NotNull Perk
    The perk that stopped them.
    @NotNull org.bukkit.entity.Player
    The player who was stopped.
    boolean
    Whether the limit message is withheld.
    void
    setMessageSuppressed(boolean messageSuppressed)
    Withholds the limit message, for a listener that tells the player itself.

    Methods inherited from class org.bukkit.event.Event

    callEvent, getEventName, isAsynchronous

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PerkLimitReachedEvent

      public PerkLimitReachedEvent(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull Perk perk, int limit, @Nullable @Nullable PerkTier currentTier, @Nullable @Nullable PerkTier nextTier)
  • Method Details

    • getPlayer

      @NotNull public @NotNull org.bukkit.entity.Player getPlayer()
      The player who was stopped.
    • getPerk

      @NotNull public @NotNull Perk getPerk()
      The perk that stopped them.
    • getLimit

      public int getLimit()
      The player's value of a Perk.Type.NUMBER perk, which they reached; 0 for a toggle perk they are not allowed.
    • getCurrentTier

      @NotNull public @NotNull Optional<PerkTier> getCurrentTier()
      The tier the player belongs to, or empty when they hold none.
    • getNextTier

      @NotNull public @NotNull Optional<PerkTier> getNextTier()
      The lowest tier above theirs that would allow the action, or empty when none would.
    • isMessageSuppressed

      public boolean isMessageSuppressed()
      Whether the limit message is withheld.
    • setMessageSuppressed

      public void setMessageSuppressed(boolean messageSuppressed)
      Withholds the limit message, for a listener that tells the player itself.
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Description copied from class: ZentrixEvent
      Gets the handler list for this event.
      Overrides:
      getHandlers in class ZentrixEvent
      Returns:
      The handler list
    • getHandlerList

      @NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()