Class EditSessionBuilder

java.lang.Object
com.sk89q.worldedit.EditSessionBuilder

public final class EditSessionBuilder extends Object
A builder-style factory for EditSessions.
  • Method Details

    • world

      public EditSessionBuilder world(@Nullable World world)
      Set the world for the EditSession.
      Parameters:
      world - the world
      Returns:
      this builder
    • getWorld

      @Nullable public World getWorld()
      Get the world to be edited if present or null
    • getMaxBlocks

      public int getMaxBlocks()
      Get the maximum number of block changes allowed
    • maxBlocks

      public EditSessionBuilder maxBlocks(int maxBlocks)
      Set the maximum blocks to change for the EditSession.
      Parameters:
      maxBlocks - the maximum blocks to change
      Returns:
      this builder
    • getActor

      @Nullable public Actor getActor()
      Get the actor associated with the edit if present or null
    • actor

      public EditSessionBuilder actor(@Nullable Actor actor)
      Set the actor who owns the EditSession.
      Parameters:
      actor - the actor
      Returns:
      this builder
    • getBlockBag

      @Nullable public BlockBag getBlockBag()
      Get the BlockBag associated with the edit if present or null
    • blockBag

      public EditSessionBuilder blockBag(@Nullable BlockBag blockBag)
      Set the block bag for the EditSession.
      Parameters:
      blockBag - the block bag
      Returns:
      this builder
    • isTracing

      public boolean isTracing()
      Check if tracing is enabled. Internal use only.
    • tracing

      public EditSessionBuilder tracing(boolean tracing)
      Set tracing enabled/disabled. Internal use only.
    • locatableActor

      public <A extends Actor & Locatable> EditSessionBuilder locatableActor(A locatable)
      Set the actor to one with a location/extent associated. Sets both the actor and the world.
    • build

      public EditSession build()
      Build the EditSession using properties described in this builder.
      Returns:
      the new EditSession
    • event

      public EditSessionBuilder event(@Nullable EditSessionEvent event)
      Set the EditSessionEvent instance to be used for firing at different stages of preparation
    • limit

      public EditSessionBuilder limit(@Nullable FaweLimit limit)
      Set the limit(s) for the edit to use
    • limitUnlimited

      public EditSessionBuilder limitUnlimited()
      Set the edit to be able to edit everywhere, and for any number of blocks
    • limitUnprocessed

      public EditSessionBuilder limitUnprocessed(@Nonnull Actor player)
      Unlimited in regions/block changes, but uses the given Actor's inventory mode.
    • changeSet

      public EditSessionBuilder changeSet(@Nullable AbstractChangeSet changeSet)
      Set the changeset to be used for history
    • changeSetNull

      public EditSessionBuilder changeSetNull()
      Do not process any history
    • command

      public EditSessionBuilder command(String command)
      Set the command used that created this edit. Used in RollbackOptimizedHistory
    • changeSet

      public EditSessionBuilder changeSet(boolean disk, @Nullable UUID uuid)
      Create a new changeset to be used for the edit's history.
      Parameters:
      disk - If disk should be used for history storage
      uuid - UUID to be used for the history or null if unneeded.
    • allowedRegions

      public EditSessionBuilder allowedRegions(@Nullable Region[] allowedRegions)
      Set the regions the edit is allowed to operate in. Set to null for the regions to be calculated based on the actor if present
    • allowedRegions

      @Deprecated public EditSessionBuilder allowedRegions(@Nullable RegionWrapper[] allowedRegions)
      Deprecated.
      Set the regions the edit is allowed to operate in. Set to null for the regions to be calculated based on the actor if present
    • allowedRegions

      public EditSessionBuilder allowedRegions(@Nullable RegionWrapper allowedRegion)
      Set the region the edit is allowed to operate in. Set to null for the regions to be calculated based on the actor if present
    • disallowedRegions

      public EditSessionBuilder disallowedRegions(@Nullable Region[] disallowedRegions)
      Set the regions the edit is allowed to operate in. Set to null for the regions to be calculated based on the actor if present
    • disallowedRegions

      @Deprecated public EditSessionBuilder disallowedRegions(@Nullable RegionWrapper[] disallowedRegions)
      Deprecated.
      Set the regions the edit is allowed to operate in. Set to null for the regions to be calculated based on the actor if present
    • disallowedRegions

      public EditSessionBuilder disallowedRegions(@Nullable RegionWrapper disallowedRegion)
      Set the region the edit is allowed to operate in. Set to null for the regions to be calculated based on the actor if present
    • allowedRegionsEverywhere

      public EditSessionBuilder allowedRegionsEverywhere()
      Set the edit to be allowed to edit everywhere
    • fastMode

      public EditSessionBuilder fastMode(@Nullable Boolean fastMode)
      Set fast mode. Use null to set to actor's fast mode setting. Also set to true by default if history for console disabled
    • relightMode

      public EditSessionBuilder relightMode(@Nullable RelightMode relightMode)
      Set the RelightMode
    • checkMemory

      public EditSessionBuilder checkMemory(@Nullable Boolean checkMemory)
      Override if memory usage should be checked during editsession compilation. By default, checks memory if fastmode is not enabled and actor is not null.
    • combineStages

      public EditSessionBuilder combineStages(@Nullable Boolean combineStages)
      Record history with dispatching:, - Much faster as it avoids duplicate block checks, - Slightly worse compression since dispatch order is different.
    • compile

      public EditSessionBuilder compile()
      Compile the builder to the settings given. Prepares history, limits, lighting, etc.
    • getRelighter

      public Relighter getRelighter()
      Get the relight engine to be used
    • isWNAMode

      public boolean isWNAMode()
      If the edit will force using WNA
    • getAllowedRegions

      @Nullable public Region[] getAllowedRegions()
      get the allowed regions associated with the edit's restricttions
    • forceWNA

      public EditSessionBuilder forceWNA()
      Force WNA to be used instead of FAWE's queue system. Will use more memory, be slower, and more likely to cause issues.
    • isWrapped

      public boolean isWrapped()
      If an EditSessionEvent has been fired yet
    • getBypassHistory

      public Extent getBypassHistory()
      Get the base extent that blocks are set to, bypassing any restrictions, limits and history. All extents up to and including EditSession.Stage.BEFORE_REORDER
    • getBypassAll

      public Extent getBypassAll()
      Get the base extent that blocks are set to, bypassing any restrictions, limits and history. All extents up to and including EditSession.Stage.BEFORE_CHANGE
    • getLimit

      @Nonnull public FaweLimit getLimit()
      Get the edit's limits
    • getChangeTask

      public AbstractChangeSet getChangeTask()
      Get the change set that will be used for history
    • getExtent

      public Extent getExtent()
      Get the ultimate resultant extent