Class ClaimOwnerChangeEvent
java.lang.Object
org.bukkit.event.Event
net.mathias2246.buildmc.api.event.CustomEvent
net.mathias2246.buildmc.api.event.claims.ClaimOwnerChangeEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
Called when the owner ID of a
Claim is about to change.
This event is fired before the owner is actually updated. It is cancellable, allowing other plugins to prevent the ownership change from occurring.
The owner ID is a string-based identifier whose meaning depends on the
ClaimType. It may
represent a player UUID (as a string), a team identifier, or a special
value such as "server".
Typical this is only triggered by another plugin changing the owner via the API.
If this event is cancelled, the claim owner will remain unchanged.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Field Summary
Fields inherited from class CustomEvent
metadataHolder -
Constructor Summary
ConstructorsConstructorDescriptionClaimOwnerChangeEvent(@NotNull Claim claim, @NotNull String oldOwnerId, @NotNull String newOwnerId) Creates a new claim owner change event. -
Method Summary
Modifier and TypeMethodDescription@NotNull ClaimgetClaim()Gets the claim whose ownership is being changed.static @NotNull org.bukkit.event.HandlerListGets the static list of handlers for this event type.@NotNull org.bukkit.event.HandlerListGets the handler list for this event instance.@NotNull StringGets the new owner ID that will be assigned to the claim if the event is not cancelled.@NotNull StringGets the previous owner ID of the claim.longGets the timestamp (in milliseconds since epoch) when this event instance was created.booleanChecks whether this event has been cancelled.voidsetCancelled(boolean cancel) 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
-
ClaimOwnerChangeEvent
public ClaimOwnerChangeEvent(@NotNull @NotNull Claim claim, @NotNull @NotNull String oldOwnerId, @NotNull @NotNull String newOwnerId) Creates a new claim owner change event.- Parameters:
claim- The claim whose owner is changingoldOwnerId- The previous owner IDnewOwnerId- The new owner ID that will be set if the event is not cancelled
-
-
Method Details
-
getClaim
Gets the claim whose ownership is being changed. The state did not change to reflect the update yet.- Returns:
- the affected claim
-
getOldOwnerId
Gets the previous owner ID of the claim.- Returns:
- the old owner ID
-
getNewOwnerId
Gets the new owner ID that will be assigned to the claim if the event is not cancelled.- Returns:
- the new owner ID
-
getTimestamp
public long getTimestamp()Gets the timestamp (in milliseconds since epoch) when this event instance was created.- Returns:
- the event creation timestamp
-
isCancelled
public boolean isCancelled()Checks whether this event has been cancelled.- Specified by:
isCancelledin interfaceorg.bukkit.event.Cancellable- Returns:
trueif the ownership change should be prevented
-
setCancelled
public void setCancelled(boolean cancel) Sets the cancellation state of this event.- Specified by:
setCancelledin interfaceorg.bukkit.event.Cancellable- Parameters:
cancel-trueto prevent the ownership change,falseto allow it
-
getHandlers
@NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()Gets the handler list for this event instance.- Specified by:
getHandlersin classCustomEvent- Returns:
- the handler list
-
getHandlerList
@NotNull public static @NotNull 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
-