Class ClaimCreateEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
This event is fired synchronously on the main server thread, before the
claims are persisted to the database. Because the claims have not yet been
persisted, Claim.getId() will always return null for every
claim in this event — the ID is assigned by the database layer once the
claim is actually saved.
If the event is cancelled, none of the claims will be created.
Once the claims have been successfully persisted, ClaimRegisteredEvent
is fired with the fully persisted claims (i.e. Claim.getId() populated).
- See Also:
-
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
ConstructorsConstructorDescriptionClaimCreateEvent(@NotNull List<@NotNull Claim> claims) Constructs a newClaimCreateEventfor multiple claims.ClaimCreateEvent(@NotNull Claim claim) Constructs a newClaimCreateEventfor a claim. -
Method Summary
Modifier and TypeMethodDescription@NotNull ClaimgetClaim()Convenience method for single-claim operations.@NotNull com.google.common.collect.ImmutableList<@NotNull Claim> Gets an immutable list of claims being created.static @NotNull org.bukkit.event.HandlerListRequired by the Bukkit event system for registration.@NotNull org.bukkit.event.HandlerListReturns theHandlerListfor this event type.booleanvoidsetCancelled(boolean cancel) Methods inherited from class CustomEvent
getMetadata, putMetadata, removeMetadataMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
ClaimCreateEvent
Constructs a newClaimCreateEventfor multiple claims.- Parameters:
claims- the claims that are about to be created. Note thatClaim.getId()will benullfor each of these, as they have not yet been persisted. Once persisted,ClaimRegisteredEventwill be fired with the fully populated claims.
-
ClaimCreateEvent
Constructs a newClaimCreateEventfor a claim.- Parameters:
claim- the claim that is about to be created. Note thatClaim.getId()will benull, as it has not yet been persisted. Once persisted,ClaimRegisteredEventwill be fired with the fully populated claim.
-
-
Method Details
-
getClaims
Gets an immutable list of claims being created.As these claims have not yet been persisted to the database,
Claim.getId()will always returnnullfor each of them. SeeClaimRegisteredEventfor an equivalent event fired after persistence, where the IDs are populated.- Returns:
- all claims included in this creation operation
-
getClaim
Convenience method for single-claim operations.If multiple claims are present, this returns the first one. Plugins that care about bulk operations (BulkMC-Core xD) should use
getClaims().As with
getClaims(), the returned claim has not yet been persisted, soClaim.getId()will returnnull. SeeClaimRegisteredEvent.getClaim()for the persisted equivalent.- Returns:
- the first claim in the list
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceorg.bukkit.event.Cancellable
-
setCancelled
public void setCancelled(boolean cancel) - Specified by:
setCancelledin interfaceorg.bukkit.event.Cancellable
-
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
@NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()Required by the Bukkit event system for registration.- Returns:
- the static handler list
-