Package simplexity.scythe.events
Class ToggleEvent
java.lang.Object
org.bukkit.event.Event
simplexity.scythe.events.ToggleEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
public class ToggleEvent
extends org.bukkit.event.Event
implements org.bukkit.event.Cancellable
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result
-
Constructor Summary
ConstructorDescriptionToggleEvent
(org.bukkit.entity.Player player, org.bukkit.NamespacedKey namespacedKey) -
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
org.bukkit.entity.Player
Gets the player whose settings were toggledboolean
Gets if the event is cancelledvoid
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
-
ToggleEvent
public ToggleEvent(org.bukkit.entity.Player player, org.bukkit.NamespacedKey namespacedKey)
-
-
Method Details
-
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
-
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 -
getHandlers
@NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()- Specified by:
getHandlers
in classorg.bukkit.event.Event
-
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
-
getPlayer
public org.bukkit.entity.Player getPlayer()Gets the player whose settings were toggled- Returns:
- Player
-