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

public class ClaimOwnerChangeEvent extends CustomEvent implements 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

    Constructors
    Constructor
    Description
    ClaimOwnerChangeEvent(@NotNull Claim claim, @NotNull String oldOwnerId, @NotNull String newOwnerId)
    Creates a new claim owner change event.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull Claim
    Gets the claim whose ownership is being changed.
    static @NotNull org.bukkit.event.HandlerList
    Gets the static list of handlers for this event type.
    @NotNull org.bukkit.event.HandlerList
    Gets the handler list for this event instance.
    @NotNull String
    Gets the new owner ID that will be assigned to the claim if the event is not cancelled.
    @NotNull String
    Gets the previous owner ID of the claim.
    long
    Gets the timestamp (in milliseconds since epoch) when this event instance was created.
    boolean
    Checks whether this event has been cancelled.
    void
    setCancelled(boolean cancel)
    Sets the cancellation state of this event.

    Methods inherited from class CustomEvent

    getMetadata, putMetadata, removeMetadata

    Methods inherited from class org.bukkit.event.Event

    callEvent, getEventName, isAsynchronous

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 changing
      oldOwnerId - The previous owner ID
      newOwnerId - The new owner ID that will be set if the event is not cancelled
  • Method Details

    • getClaim

      @NotNull public @NotNull Claim getClaim()
      Gets the claim whose ownership is being changed. The state did not change to reflect the update yet.
      Returns:
      the affected claim
    • getOldOwnerId

      @NotNull public @NotNull String getOldOwnerId()
      Gets the previous owner ID of the claim.
      Returns:
      the old owner ID
    • getNewOwnerId

      @NotNull public @NotNull String 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:
      isCancelled in interface org.bukkit.event.Cancellable
      Returns:
      true if the ownership change should be prevented
    • setCancelled

      public void setCancelled(boolean cancel)
      Sets the cancellation state of this event.
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
      Parameters:
      cancel - true to prevent the ownership change, false to allow it
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Gets the handler list for this event instance.
      Specified by:
      getHandlers in class CustomEvent
      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