Class BatchOption

java.lang.Object
net.minestom.server.instance.batch.BatchOption

public class BatchOption extends Object
Represents options for Batchs.
  • 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, a Batch 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() and Batch.awaitReady() may be used to check if it is ready and block until it is ready.

      The default implementations of ChunkBatch, AbsoluteBlockBatch, and RelativeBlockBatch 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

      @NotNull @Contract("_ -> this") public @NotNull BatchOption setFullChunk(boolean fullChunk)
      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

      @NotNull @Contract("_ -> this") public @NotNull BatchOption setUnsafeApply(boolean unsafeApply)
      Parameters:
      unsafeApply - true to make this batch apply without checking if it is ready to apply.
      Returns:
      'this' for chaining
      See Also:
    • setSendUpdate

      @Contract("_ -> this") public BatchOption setSendUpdate(boolean sendUpdate)