Class ClaimProtectionChangeEvent
java.lang.Object
org.bukkit.event.Event
net.mathias2246.buildmc.api.event.CustomEvent
net.mathias2246.buildmc.api.event.claims.ClaimProtectionChangeEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
Called when a
Protection of a Claim is about to change.
This event is fired before the protection status is actually updated. It is cancellable, allowing other plugins to prevent the protection status change from occurring.
This event is called when a plugin, or player toggles a protection of a claim.
If this event is cancelled, the protection status will remain unchanged.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Field Summary
Fields inherited from class CustomEvent
metadataHolder -
Constructor Summary
ConstructorsConstructorDescriptionClaimProtectionChangeEvent(@NotNull Claim claim, @NotNull Protection protection, @NotNull ClaimProtectionChangeEvent.ActiveState newState) -
Method Summary
Modifier and TypeMethodDescription@NotNull ClaimgetClaim()Gets the claim where the protection was toggled on or off.static org.bukkit.event.HandlerListGets the static list of handlers for this event type.@NotNull org.bukkit.event.HandlerListReturns theHandlerListfor this event type.Gets the new state of the protection after the change.@NotNull ProtectionGets the protection that was toggled on or off.longGets when the change occurred.booleanGets the cancellation state of this event.booleanIf the new state of the protection isClaimProtectionChangeEvent.ActiveState.DISABLED.booleanIf the new state of the protection isClaimProtectionChangeEvent.ActiveState.ENABLED.voidsetCancelled(boolean b) Sets the cancellation state of this event.Methods inherited from class CustomEvent
getMetadata, putMetadata, removeMetadataMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
ClaimProtectionChangeEvent
public ClaimProtectionChangeEvent(@NotNull @NotNull Claim claim, @NotNull @NotNull Protection protection, @NotNull @NotNull ClaimProtectionChangeEvent.ActiveState newState)
-
-
Method Details
-
getClaim
Gets the claim where the protection was toggled on or off. -
getProtection
Gets the protection that was toggled on or off. -
getNewState
Gets the new state of the protection after the change. -
getTimestamp
public long getTimestamp()Gets when the change occurred. -
isEnabled
public boolean isEnabled()If the new state of the protection isClaimProtectionChangeEvent.ActiveState.ENABLED.- See Also:
-
isDisabled
public boolean isDisabled()If the new state of the protection isClaimProtectionChangeEvent.ActiveState.DISABLED.- See Also:
-
isCancelled
public boolean isCancelled()Gets the cancellation state of this event.If this event is cancelled, the protection status will remain unchanged.
- Specified by:
isCancelledin interfaceorg.bukkit.event.Cancellable- Returns:
- If this event is cancelled
-
setCancelled
public void setCancelled(boolean b) Sets the cancellation state of this event.If this event is cancelled, the protection status will remain unchanged.
- Specified by:
setCancelledin interfaceorg.bukkit.event.Cancellable- Parameters:
b- If the event should be cancelled or not
-
getHandlers
@NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()Description copied from class:CustomEventReturns theHandlerListfor this event type.Bukkit requires each concrete event class to define its own static
HandlerListinstance and to return it from this method. This is necessary for Bukkitâs event registration and dispatch system.- Specified by:
getHandlersin classCustomEvent- Returns:
- the handler list for this event (never
null)
-
getHandlerList
public static org.bukkit.event.HandlerList getHandlerList()Gets the static list of handlers for this event type.Required by the Bukkit event system for registration.
- Returns:
- the handler list
-