Class PolyhedralRegionSelector

java.lang.Object
com.fastasyncworldedit.core.regions.selector.PolyhedralRegionSelector
All Implemented Interfaces:
CUIRegion, RegionSelector

public class PolyhedralRegionSelector extends Object implements RegionSelector, CUIRegion
Creates a PolyhedralRegion from a user's selections.
  • Constructor Details

    • PolyhedralRegionSelector

      public PolyhedralRegionSelector()
      Create a new selector with a null world.
    • PolyhedralRegionSelector

      public PolyhedralRegionSelector(@Nullable World world)
      Create a new selector.
      Parameters:
      world - the world, which may be null
  • Method Details

    • getWorld

      @Nullable public World getWorld()
      Description copied from interface: RegionSelector
      Get the world for the region selector.
      Specified by:
      getWorld in interface RegionSelector
      Returns:
      a world, which may be null
    • setWorld

      public void setWorld(@Nullable World world)
      Description copied from interface: RegionSelector
      Set the world for the region selector.
      Specified by:
      setWorld in interface RegionSelector
      Parameters:
      world - the world, which may be null
    • selectPrimary

      public boolean selectPrimary(BlockVector3 position, SelectorLimits limits)
      Description copied from interface: RegionSelector
      Called when the first point is selected.
      Specified by:
      selectPrimary in interface RegionSelector
      Parameters:
      position - the position
      Returns:
      true if something changed
    • selectSecondary

      public boolean selectSecondary(BlockVector3 position, SelectorLimits limits)
      Description copied from interface: RegionSelector
      Called when the second point is selected.
      Specified by:
      selectSecondary in interface RegionSelector
      Parameters:
      position - the position
      Returns:
      true if something changed
    • getPrimaryPosition

      public BlockVector3 getPrimaryPosition() throws IncompleteRegionException
      Description copied from interface: RegionSelector
      Get the primary position.
      Specified by:
      getPrimaryPosition in interface RegionSelector
      Returns:
      the primary position
      Throws:
      IncompleteRegionException - thrown if a region has not been fully defined
    • getRegion

      public Region getRegion() throws IncompleteRegionException
      Description copied from interface: RegionSelector
      Get the selection.
      Specified by:
      getRegion in interface RegionSelector
      Returns:
      the created region
      Throws:
      IncompleteRegionException - thrown if a region has not been fully defined
    • getIncompleteRegion

      public Region getIncompleteRegion()
      Description copied from interface: RegionSelector
      Get the region even if it's not fully defined.
      Specified by:
      getIncompleteRegion in interface RegionSelector
      Returns:
      an incomplete region object that is incomplete
    • isDefined

      public boolean isDefined()
      Description copied from interface: RegionSelector
      Returns whether the region has been fully defined.
      Specified by:
      isDefined in interface RegionSelector
      Returns:
      true if a selection is available
    • getArea

      public int getArea()
      Description copied from interface: RegionSelector
      Get the number of blocks inside the region.
      Specified by:
      getArea in interface RegionSelector
      Returns:
      number of blocks, or -1 if undefined
    • learnChanges

      public void learnChanges()
      Description copied from interface: RegionSelector
      Update the selector with changes to the region.
      Specified by:
      learnChanges in interface RegionSelector
    • clear

      public void clear()
      Description copied from interface: RegionSelector
      Clear the selection.
      Specified by:
      clear in interface RegionSelector
    • getTypeName

      public String getTypeName()
      Description copied from interface: RegionSelector
      Get a lowercase name of this region selector type.
      Specified by:
      getTypeName in interface RegionSelector
      Returns:
      a lower case name of the type
    • getInformationLines

      public List<String> getInformationLines()
      Description copied from interface: RegionSelector
      Get lines of information about the selection.
      Specified by:
      getInformationLines in interface RegionSelector
      Returns:
      a list of lines describing the region
    • explainPrimarySelection

      public void explainPrimarySelection(Actor player, LocalSession session, BlockVector3 pos)
      Description copied from interface: RegionSelector
      Tell the player information about his/her primary selection.
      Specified by:
      explainPrimarySelection in interface RegionSelector
      Parameters:
      player - the actor
      session - the session
      pos - position
    • explainSecondarySelection

      public void explainSecondarySelection(Actor player, LocalSession session, BlockVector3 pos)
      Description copied from interface: RegionSelector
      Tell the player information about his/her secondary selection.
      Specified by:
      explainSecondarySelection in interface RegionSelector
      Parameters:
      player - the actor
      session - the session
      pos - position
    • explainRegionAdjust

      public void explainRegionAdjust(Actor player, LocalSession session)
      Description copied from interface: RegionSelector
      Tell the player information about the region's changes. This may resend all the defining region information if needed.
      Specified by:
      explainRegionAdjust in interface RegionSelector
      Parameters:
      player - the actor
      session - the session
    • getProtocolVersion

      public int getProtocolVersion()
      Description copied from interface: CUIRegion
      Returns the CUI version that is required to send up-to-date data. If the CUI version is smaller than this value, the legacy methods will be called.
      Specified by:
      getProtocolVersion in interface CUIRegion
      Returns:
      the protocol version
    • getTypeID

      public String getTypeID()
      Description copied from interface: CUIRegion
      Returns the type ID to send to CUI in the selection event.
      Specified by:
      getTypeID in interface CUIRegion
      Returns:
      the type ID
    • describeCUI

      public void describeCUI(LocalSession session, Actor player)
      Description copied from interface: CUIRegion
      Sends CUI events describing the region for versions of CUI equal to or greater than the value supplied by getProtocolVersion().
      Specified by:
      describeCUI in interface CUIRegion
    • getLegacyTypeID

      public String getLegacyTypeID()
      Description copied from interface: CUIRegion
      Returns the type ID to send to CUI in the selection event if the CUI is in legacy mode.
      Specified by:
      getLegacyTypeID in interface CUIRegion
      Returns:
      the legacy type ID
    • describeLegacyCUI

      public void describeLegacyCUI(LocalSession session, Actor player)
      Description copied from interface: CUIRegion
      Sends CUI events describing the region for versions of CUI smaller than the value supplied by getProtocolVersion().
      Specified by:
      describeLegacyCUI in interface CUIRegion
    • getVertices

      public List<BlockVector3> getVertices()
      Description copied from interface: RegionSelector
      Get the vertices.
      Specified by:
      getVertices in interface RegionSelector
      Returns:
      the list of vertices