Interface RegionSelector

All Known Implementing Classes:
ConvexPolyhedralRegionSelector, CuboidRegionSelector, CylinderRegionSelector, EllipsoidRegionSelector, ExtendingCuboidRegionSelector, FuzzyRegionSelector, Polygonal2DRegionSelector, PolyhedralRegionSelector, SphereRegionSelector

public interface RegionSelector
Region selectors create Regions from a series of "selected points." They are used, for example, to allow users to create a CuboidRegion by selecting two corners of the cuboid.
  • Method Details

    • getWorld

      @Nullable World getWorld()
      Get the world for the region selector.
      Returns:
      a world, which may be null
    • setWorld

      void setWorld(@Nullable World world)
      Set the world for the region selector.
      Parameters:
      world - the world, which may be null
    • selectPrimary

      boolean selectPrimary(BlockVector3 position, SelectorLimits limits)
      Called when the first point is selected.
      Parameters:
      position - the position
      Returns:
      true if something changed
    • selectSecondary

      boolean selectSecondary(BlockVector3 position, SelectorLimits limits)
      Called when the second point is selected.
      Parameters:
      position - the position
      Returns:
      true if something changed
    • explainPrimarySelection

      void explainPrimarySelection(Actor actor, LocalSession session, BlockVector3 position)
      Tell the player information about his/her primary selection.
      Parameters:
      actor - the actor
      session - the session
      position - position
    • explainSecondarySelection

      void explainSecondarySelection(Actor actor, LocalSession session, BlockVector3 position)
      Tell the player information about his/her secondary selection.
      Parameters:
      actor - the actor
      session - the session
      position - position
    • explainRegionAdjust

      void explainRegionAdjust(Actor actor, LocalSession session)
      Tell the player information about the region's changes. This may resend all the defining region information if needed.
      Parameters:
      actor - the actor
      session - the session
    • getPrimaryPosition

      BlockVector3 getPrimaryPosition() throws IncompleteRegionException
      Get the primary position.
      Returns:
      the primary position
      Throws:
      IncompleteRegionException - thrown if a region has not been fully defined
    • getRegion

      Region getRegion() throws IncompleteRegionException
      Get the selection.
      Returns:
      the created region
      Throws:
      IncompleteRegionException - thrown if a region has not been fully defined
    • getIncompleteRegion

      Region getIncompleteRegion()
      Get the region even if it's not fully defined.
      Returns:
      an incomplete region object that is incomplete
    • isDefined

      boolean isDefined()
      Returns whether the region has been fully defined.
      Returns:
      true if a selection is available
    • getArea

      @Deprecated default int getArea()
      Deprecated.
      Get the number of blocks inside the region.
      Returns:
      number of blocks, or -1 if undefined
    • getVolume

      @NonAbstractForCompatibility(delegateName="getArea", delegateParams={}) default long getVolume()
      Get the number of blocks inside the region.
      Returns:
      number of blocks, or -1 if undefined
    • learnChanges

      void learnChanges()
      Update the selector with changes to the region.
    • clear

      void clear()
      Clear the selection.
    • getTypeName

      String getTypeName()
      Get a lowercase name of this region selector type.
      Returns:
      a lower case name of the type
    • getInformationLines

      @Deprecated default List<String> getInformationLines()
      Deprecated.
      Get lines of information about the selection.
      Returns:
      a list of lines describing the region
    • getSelectionInfoLines

      default List<com.sk89q.worldedit.util.formatting.text.Component> getSelectionInfoLines()
      Get lines of information about the selection.
      Returns:
      a list of lines describing the region.
    • getVertices

      default List<BlockVector3> getVertices() throws IncompleteRegionException
      Get the vertices.
      Returns:
      the list of vertices
      Throws:
      IncompleteRegionException - thrown if a region has not been fully defined