Package simplexity.villagerinfo.events
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
ConstructorDescriptionPlayerToggleEvent
(org.bukkit.entity.Player player, org.bukkit.NamespacedKey namespacedKey, String toggleType) -
Method Summary
Modifier and TypeMethodDescriptionbyte
Gets the current toggle state of the player
Returns a default of 0b (Enabled) if there was no information on the playerstatic org.bukkit.event.HandlerList
@NotNull org.bukkit.event.HandlerList
Gets the handler list for this eveneorg.bukkit.entity.Player
Gets the player whose settings were toggledGets the toggle that was used
Uses the TOGGLE_TYPE_HIGHLIGHT, TOGGLE_TYPE_OUTPUT, and TOGGLE_TYPE_SOUND messages from the MessageInsert enumboolean
Gets if the event is cancelledvoid
sendPlayerFeedback
(String state) Sends the player feedback on what the toggle was set to.void
setCancelled
(boolean cancel) Sets if the event should be cancelledvoid
Sets the toggle to be disabled in the player's PDC
Sets value to 1bvoid
Sets the toggle to be enabled in the player's PDC
Sets value to 0b
Calls sendPlayerFeedback() with the ENABLED_MESSAGE_FORMAT messageMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
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 classorg.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 interfaceorg.bukkit.event.Cancellable
- Returns:
- boolean
-
setCancelled
public void setCancelled(boolean cancel) Sets if the event should be cancelled- Specified by:
setCancelled
in interfaceorg.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
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
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
-