Class SetNickEvent

java.lang.Object
org.bukkit.event.Event
dev.majek.hexnicks.api.SetNickEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class SetNickEvent extends org.bukkit.event.Event implements org.bukkit.event.Cancellable
Handles the event fired when a player sets their nickname.
  • Nested Class Summary

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

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

    Constructors
    Constructor
    Description
    SetNickEvent(@NotNull org.bukkit.entity.Player player, @NotNull net.kyori.adventure.text.Component newNick, @Nullable net.kyori.adventure.text.Component oldNick)
    Fires when a player changes their nickname using /nick.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.bukkit.event.HandlerList
    Get the HandlerList.
    @NotNull org.bukkit.event.HandlerList
    boolean
    net.kyori.adventure.text.Component
    The new nickname the player is attempting to set.
    void
    newNick(@NotNull net.kyori.adventure.text.Component newNick)
    Set the player's new nickname.
    @Nullable net.kyori.adventure.text.Component
    The old nickname if the player had one previously.
    org.bukkit.entity.Player
    The in-game player attempting to change the nickname.
    void
    setCancelled(boolean cancel)

    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

    • SetNickEvent

      public SetNickEvent(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull net.kyori.adventure.text.Component newNick, @Nullable @Nullable net.kyori.adventure.text.Component oldNick)
      Fires when a player changes their nickname using /nick.
      Parameters:
      player - The in-game player changing the nickname.
      newNick - The new nickname the player is attempting to set.
      oldNick - The player's old name if they had one.
  • Method Details

    • player

      public org.bukkit.entity.Player player()
      The in-game player attempting to change the nickname.
      Returns:
      Player.
    • oldNick

      @Nullable public @Nullable net.kyori.adventure.text.Component oldNick()
      The old nickname if the player had one previously.
      Returns:
      Old nickname.
    • newNick

      public void newNick(@NotNull @NotNull net.kyori.adventure.text.Component newNick)
      Set the player's new nickname.
      Parameters:
      newNick - New nickname.
    • newNick

      public net.kyori.adventure.text.Component newNick()
      The new nickname the player is attempting to set.
      Returns:
      New nickname.
    • isCancelled

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

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

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class org.bukkit.event.Event
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()
      Get the HandlerList. Bukkit requires this.
      Returns:
      HandlerList.