Package org.bukkit.event.world
Class AsyncStructureGenerateEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.world.WorldEvent
org.bukkit.event.world.AsyncStructureGenerateEvent
This event will sometimes fire synchronously, depending on how it was
triggered.
The constructor provides a boolean to indicate if the event was fired synchronously or asynchronously. When asynchronous, this event can be called from any thread, sans the main thread, and has limited access to the API.
If a Structure
is naturally placed in a chunk of the world, this
event will be asynchronous. If a player executes the '/place structure'
command, this event will be synchronous.
Allows to register transformers that can modify the blocks placed and
entities spawned by the structure.
Care should be taken to check Event.isAsynchronous()
and treat the event
appropriately.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Constructor Summary
ConstructorDescriptionAsyncStructureGenerateEvent
(@NotNull World world, boolean async, @NotNull AsyncStructureGenerateEvent.Cause cause, @NotNull Structure structure, @NotNull BoundingBox boundingBox, int chunkX, int chunkZ) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Removes all block transformers.void
Removes all entity transformers.Gets a block transformer by key.Gets all block transformers in a unmodifiable map.Get the bounding box of the structure.getCause()
Gets the event cause.int
Get the x coordinate of the origin chunk of the structure.int
Get the z coordinate of the origin chunk of the structure.Gets a entity transformer by key.Gets all entity transformers in a unmodifiable map.static @NotNull HandlerList
Get the structure reference that is generated.void
Removes a block transformer.void
Removes a entity transformer.void
setBlockTransformer
(@NotNull NamespacedKey key, @NotNull BlockTransformer transformer) Sets a block transformer to a key.void
setEntityTransformer
(@NotNull NamespacedKey key, @NotNull EntityTransformer transformer) Sets a entity transformer to a key.Methods inherited from class org.bukkit.event.world.WorldEvent
getWorld
Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
AsyncStructureGenerateEvent
-
-
Method Details
-
getCause
Gets the event cause.- Returns:
- the event cause
-
getBlockTransformer
@Nullable public @Nullable BlockTransformer getBlockTransformer(@NotNull @NotNull NamespacedKey key) Gets a block transformer by key.- Parameters:
key
- the key of the block transformer- Returns:
- the block transformer or null
-
setBlockTransformer
public void setBlockTransformer(@NotNull @NotNull NamespacedKey key, @NotNull @NotNull BlockTransformer transformer) Sets a block transformer to a key.- Parameters:
key
- the keytransformer
- the block transformer
-
removeBlockTransformer
Removes a block transformer.- Parameters:
key
- the key of the block transformer
-
clearBlockTransformers
public void clearBlockTransformers()Removes all block transformers. -
getBlockTransformers
Gets all block transformers in a unmodifiable map.- Returns:
- the block transformers in a map
-
getEntityTransformer
@Nullable public @Nullable EntityTransformer getEntityTransformer(@NotNull @NotNull NamespacedKey key) Gets a entity transformer by key.- Parameters:
key
- the key of the entity transformer- Returns:
- the entity transformer or null
-
setEntityTransformer
public void setEntityTransformer(@NotNull @NotNull NamespacedKey key, @NotNull @NotNull EntityTransformer transformer) Sets a entity transformer to a key.- Parameters:
key
- the keytransformer
- the entity transformer
-
removeEntityTransformer
Removes a entity transformer.- Parameters:
key
- the key of the entity transformer
-
clearEntityTransformers
public void clearEntityTransformers()Removes all entity transformers. -
getEntityTransformers
Gets all entity transformers in a unmodifiable map.- Returns:
- the entity transformers in a map
-
getStructure
Get the structure reference that is generated.- Returns:
- the structure
-
getBoundingBox
Get the bounding box of the structure.- Returns:
- the bounding box
-
getChunkX
public int getChunkX()Get the x coordinate of the origin chunk of the structure.- Returns:
- the chunk x coordinate
-
getChunkZ
public int getChunkZ()Get the z coordinate of the origin chunk of the structure.- Returns:
- the chunk z coordinate
-
getHandlers
- Specified by:
getHandlers
in classEvent
-
getHandlerList
-