public class Polygonal2DRegionSelector extends java.lang.Object implements RegionSelector, CUIRegion
Polygonal2DRegion
from a user's selections.Constructor and Description |
---|
Polygonal2DRegionSelector()
Create a new selector with a
null world. |
Polygonal2DRegionSelector(RegionSelector oldSelector)
Create a new selector from another one.
|
Polygonal2DRegionSelector(World world)
Create a new selector with the given world.
|
Polygonal2DRegionSelector(World world,
java.util.List<BlockVector2> points,
int minY,
int maxY)
Create a new selector.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the selection.
|
void |
describeCUI(LocalSession session,
Actor player)
Sends CUI events describing the region for
versions of CUI equal to or greater than the
value supplied by getProtocolVersion().
|
void |
describeLegacyCUI(LocalSession session,
Actor player)
Sends CUI events describing the region for
versions of CUI smaller than the value
supplied by getProtocolVersion().
|
void |
explainPrimarySelection(Actor player,
LocalSession session,
BlockVector3 pos)
Tell the player information about his/her primary selection.
|
void |
explainRegionAdjust(Actor player,
LocalSession session)
Tell the player information about the region's changes.
|
void |
explainSecondarySelection(Actor player,
LocalSession session,
BlockVector3 pos)
Tell the player information about his/her secondary selection.
|
Polygonal2DRegion |
getIncompleteRegion()
Get the region even if it's not fully defined.
|
java.lang.String |
getLegacyTypeID()
Returns the type ID to send to CUI in the selection
event if the CUI is in legacy mode.
|
int |
getPointCount()
Get the number of points.
|
BlockVector3 |
getPrimaryPosition()
Get the primary position.
|
int |
getProtocolVersion()
Returns the CUI version that is required to send
up-to-date data.
|
Polygonal2DRegion |
getRegion()
Get the selection.
|
java.util.List<com.sk89q.worldedit.util.formatting.text.Component> |
getSelectionInfoLines()
Get lines of information about the selection.
|
java.lang.String |
getTypeID()
Returns the type ID to send to CUI in the selection event.
|
java.lang.String |
getTypeName()
Get a lowercase name of this region selector type.
|
long |
getVolume()
Get the number of blocks inside the region.
|
World |
getWorld()
Get the world for the region selector.
|
boolean |
isDefined()
Returns whether the region has been fully defined.
|
void |
learnChanges()
Update the selector with changes to the region.
|
boolean |
selectPrimary(BlockVector3 position,
SelectorLimits limits)
Called when the first point is selected.
|
boolean |
selectSecondary(BlockVector3 position,
SelectorLimits limits)
Called when the second point is selected.
|
void |
setWorld(World world)
Set the world for the region selector.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getArea, getInformationLines
public Polygonal2DRegionSelector()
null
world.public Polygonal2DRegionSelector(@Nullable World world)
world
- the worldpublic Polygonal2DRegionSelector(RegionSelector oldSelector)
oldSelector
- the old selectorpublic Polygonal2DRegionSelector(@Nullable World world, java.util.List<BlockVector2> points, int minY, int maxY)
world
- the worldpoints
- a list of pointsminY
- the minimum YmaxY
- the maximum Y@Nullable public World getWorld()
RegionSelector
getWorld
in interface RegionSelector
public void setWorld(@Nullable World world)
RegionSelector
setWorld
in interface RegionSelector
world
- the world, which may be nullpublic boolean selectPrimary(BlockVector3 position, SelectorLimits limits)
RegionSelector
selectPrimary
in interface RegionSelector
position
- the positionpublic boolean selectSecondary(BlockVector3 position, SelectorLimits limits)
RegionSelector
selectSecondary
in interface RegionSelector
position
- the positionpublic void explainPrimarySelection(Actor player, LocalSession session, BlockVector3 pos)
RegionSelector
explainPrimarySelection
in interface RegionSelector
player
- the actorsession
- the sessionpos
- positionpublic void explainSecondarySelection(Actor player, LocalSession session, BlockVector3 pos)
RegionSelector
explainSecondarySelection
in interface RegionSelector
player
- the actorsession
- the sessionpos
- positionpublic void explainRegionAdjust(Actor player, LocalSession session)
RegionSelector
explainRegionAdjust
in interface RegionSelector
player
- the actorsession
- the sessionpublic BlockVector3 getPrimaryPosition() throws IncompleteRegionException
RegionSelector
getPrimaryPosition
in interface RegionSelector
IncompleteRegionException
- thrown if a region has not been fully definedpublic Polygonal2DRegion getRegion() throws IncompleteRegionException
RegionSelector
getRegion
in interface RegionSelector
IncompleteRegionException
- thrown if a region has not been fully definedpublic Polygonal2DRegion getIncompleteRegion()
RegionSelector
getIncompleteRegion
in interface RegionSelector
public boolean isDefined()
RegionSelector
isDefined
in interface RegionSelector
public void learnChanges()
RegionSelector
learnChanges
in interface RegionSelector
public void clear()
RegionSelector
clear
in interface RegionSelector
public java.lang.String getTypeName()
RegionSelector
getTypeName
in interface RegionSelector
public java.util.List<com.sk89q.worldedit.util.formatting.text.Component> getSelectionInfoLines()
RegionSelector
getSelectionInfoLines
in interface RegionSelector
public long getVolume()
RegionSelector
getVolume
in interface RegionSelector
public int getPointCount()
public void describeCUI(LocalSession session, Actor player)
CUIRegion
describeCUI
in interface CUIRegion
public void describeLegacyCUI(LocalSession session, Actor player)
CUIRegion
describeLegacyCUI
in interface CUIRegion
public int getProtocolVersion()
CUIRegion
getProtocolVersion
in interface CUIRegion
public java.lang.String getTypeID()
CUIRegion
public java.lang.String getLegacyTypeID()
CUIRegion
getLegacyTypeID
in interface CUIRegion