Class PlayerToggleEvent

java.lang.Object
org.bukkit.event.Event
simplexity.villagerinfo.events.PlayerToggleEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class PlayerToggleEvent extends org.bukkit.event.Event implements org.bukkit.event.Cancellable
Called when a player's info output is toggled
  • Nested Class Summary

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

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

    Constructors
    Constructor
    Description
    PlayerToggleEvent(org.bukkit.entity.Player player, org.bukkit.NamespacedKey namespacedKey, String toggleType)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    byte
    Gets the current toggle state of the player
    Returns a default of 0b (Enabled) if there was no information on the player
    static org.bukkit.event.HandlerList
     
    @NotNull org.bukkit.event.HandlerList
    Gets the handler list for this evene
    org.bukkit.entity.Player
    Gets the player whose settings were toggled
    Gets the toggle that was used
    Uses the TOGGLE_TYPE_HIGHLIGHT, TOGGLE_TYPE_OUTPUT, and TOGGLE_TYPE_SOUND messages from the MessageInsert enum
    boolean
    Gets if the event is cancelled
    void
    Sends the player feedback on what the toggle was set to.
    void
    setCancelled(boolean cancel)
    Sets if the event should be cancelled
    void
    Sets the toggle to be disabled in the player's PDC
    Sets value to 1b
    void
    Sets the toggle to be enabled in the player's PDC
    Sets value to 0b
    Calls sendPlayerFeedback() with the ENABLED_MESSAGE_FORMAT message

    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

    • PlayerToggleEvent

      public PlayerToggleEvent(org.bukkit.entity.Player player, org.bukkit.NamespacedKey namespacedKey, String toggleType)
  • Method Details

    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Gets the handler list for this evene
      Specified by:
      getHandlers in class org.bukkit.event.Event
      Returns:
      HandlerList
    • getHandlerList

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

      public boolean isCancelled()
      Gets if the event is cancelled
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
      Returns:
      boolean
    • setCancelled

      public void setCancelled(boolean cancel)
      Sets if the event should be cancelled
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
      Parameters:
      cancel - true if you wish to cancel this event
    • setDisabled

      public void setDisabled()
      Sets the toggle to be disabled in the player's PDC
      Sets value to 1b
    • setEnabled

      public void setEnabled()
      Sets the toggle to be enabled in the player's PDC
      Sets value to 0b
      Calls sendPlayerFeedback() with the ENABLED_MESSAGE_FORMAT message
    • getCurrentToggleState

      public byte getCurrentToggleState()
      Gets the current toggle state of the player
      Returns a default of 0b (Enabled) if there was no information on the player
      Returns:
      byte
    • getToggleType

      public String getToggleType()
      Gets the toggle that was used
      Uses the TOGGLE_TYPE_HIGHLIGHT, TOGGLE_TYPE_OUTPUT, and TOGGLE_TYPE_SOUND messages from the MessageInsert enum
      Returns:
      String
    • sendPlayerFeedback

      public void sendPlayerFeedback(String state)
      Sends the player feedback on what the toggle was set to.
      Uses TOGGLE_COMMAND_FEEDBACK from ServerMessage enum
      Uses ENABLED_MESSAGE_FORMAT, DISABLED_MESSAGE_FORMAT, TOGGLE_TYPE_HIGHLIGHT, TOGGLE_TYPE_OUTPUT, and TOGGLE_TYPE_SOUND from MessageInsert enum
      Parameters:
      state - String
    • getPlayer

      public org.bukkit.entity.Player getPlayer()
      Gets the player whose settings were toggled
      Returns:
      org.bukkit.entity.Player