Class StatusChangeEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
net.mathias2246.buildmc.api.event.CustomPlayerEvent
net.mathias2246.buildmc.api.event.player.StatusChangeEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class StatusChangeEvent extends CustomPlayerEvent implements org.bukkit.event.Cancellable
Called when a players status is about to change.

You can cancel this event if you want to prevent the player from changing his status.

  • Constructor Details

    • StatusChangeEvent

      public StatusChangeEvent(@NotNull @NotNull org.bukkit.entity.Player player, @Nullable @Nullable StatusInstance oldStatus, @Nullable @Nullable StatusInstance newStatus)
      The default constructor
      Parameters:
      player - the player associated with this event (must not be null)
      oldStatus - The StatusInstance the player had before trying to change his status.

      Is null if the players status was not set.

      newStatus - The StatusInstance the player gets after this event was successfully executed.

      If null the current status of the player will be removed.

  • Method Details

    • getOldStatus

      @Nullable public @Nullable StatusInstance getOldStatus()
      Returns:
      The StatusInstance the player had before changing
    • getNewStatus

      @Nullable public @Nullable StatusInstance getNewStatus()
      Returns:
      The StatusInstance the player will get after this event has successfully executed.
    • setNewStatus

      public void setNewStatus(@Nullable @Nullable StatusInstance newStatus)
      Parameters:
      newStatus - The status the player gets after this event has successfully executed

      If set to null, the players current status will be removed.

    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Description copied from class: CustomPlayerEvent
      Returns the HandlerList for this event type.

      Bukkit requires each concrete event class to define its own static HandlerList instance and to return it from this method. This is necessary for Bukkit’s event registration and dispatch system.

      Specified by:
      getHandlers in class CustomPlayerEvent
      Returns:
      the handler list for this event (never null)
    • getHandlerList

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

      public boolean isCancelled()
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
    • setCancelled

      public void setCancelled(boolean b)
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable