Class BatchOption
java.lang.Object
net.minestom.server.instance.batch.BatchOption
Represents options for
Batch
s.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets if the batch is responsible for composing the whole chunk.boolean
Gets if the batch will wait ignore whether it is ready or not when applying it.@NotNull BatchOption
setCalculateInverse
(boolean calculateInverse) @NotNull BatchOption
setFullChunk
(boolean fullChunk) setSendUpdate
(boolean sendUpdate) @NotNull BatchOption
setUnsafeApply
(boolean unsafeApply) boolean
Gets if the batch will calculate the inverse of the batch when it is applied for an 'undo' behavior.boolean
-
Constructor Details
-
BatchOption
public BatchOption()
-
-
Method Details
-
isFullChunk
public boolean isFullChunk()Gets if the batch is responsible for composing the whole chunk.Having it to true means that the batch will clear the chunk data before placing the blocks.
Defaults to false.
- Returns:
- true if the batch is responsible for all the chunk
-
shouldCalculateInverse
public boolean shouldCalculateInverse()Gets if the batch will calculate the inverse of the batch when it is applied for an 'undo' behavior.This flag will determine the return value of
Batch.apply(Instance, Object)
(and other variants). If true, aBatch
will be returned. Otherwise null will be returned.Defaults to false.
- Returns:
- true if the batch will calculate its inverse on application
- See Also:
-
isUnsafeApply
public boolean isUnsafeApply()Gets if the batch will wait ignore whether it is ready or not when applying it.If set, the batch may not be ready, or it may be partially ready which will cause an undefined result.
Batch.isReady()
andBatch.awaitReady()
may be used to check if it is ready and block until it is ready.The default implementations of
ChunkBatch
,AbsoluteBlockBatch
, andRelativeBlockBatch
are always ready unless they are an inverse batch. This is not a safe assumption, and may change in the future.Defaults to false.
- Returns:
- true if the batch will immediately
-
shouldSendUpdate
public boolean shouldSendUpdate() -
setFullChunk
- Parameters:
fullChunk
- true to make this batch composes the whole chunk- Returns:
- 'this' for chaining
- See Also:
-
setCalculateInverse
@NotNull @Contract("_ -> this") public @NotNull BatchOption setCalculateInverse(boolean calculateInverse) - Parameters:
calculateInverse
- true to make this batch calculate the inverse on application- Returns:
- 'this' for chaining
- See Also:
-
setUnsafeApply
- Parameters:
unsafeApply
- true to make this batch apply without checking if it is ready to apply.- Returns:
- 'this' for chaining
- See Also:
-
setSendUpdate
-