public class CylinderRegionSelector extends java.lang.Object implements RegionSelector, CUIRegion
CylinderRegionSelector
from a user's selections.Modifier and Type | Field and Description |
---|---|
protected static java.text.NumberFormat |
NUMBER_FORMAT |
protected CylinderRegion |
region |
Constructor and Description |
---|
CylinderRegionSelector()
Create a new region selector with a
null world. |
CylinderRegionSelector(RegionSelector oldSelector)
Create a new selector from the given one.
|
CylinderRegionSelector(World world)
Create a new region selector.
|
CylinderRegionSelector(World world,
BlockVector2 center,
Vector2 radius,
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.
|
CylinderRegion |
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.
|
BlockVector3 |
getPrimaryPosition()
Get the primary position.
|
int |
getProtocolVersion()
Returns the CUI version that is required to send
up-to-date data.
|
CylinderRegion |
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
protected static final transient java.text.NumberFormat NUMBER_FORMAT
protected transient CylinderRegion region
public CylinderRegionSelector()
null
world.public CylinderRegionSelector(@Nullable World world)
world
- the world, which may be null
public CylinderRegionSelector(RegionSelector oldSelector)
oldSelector
- the old selectorpublic CylinderRegionSelector(@Nullable World world, BlockVector2 center, Vector2 radius, int minY, int maxY)
world
- the worldcenter
- the centerradius
- the radiusminY
- 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 CylinderRegion getRegion() throws IncompleteRegionException
RegionSelector
getRegion
in interface RegionSelector
IncompleteRegionException
- thrown if a region has not been fully definedpublic CylinderRegion 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 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