public class CuboidRegionSelector extends java.lang.Object implements RegionSelector, CUIRegion
CuboidRegion
from a user's selections.Modifier and Type | Field and Description |
---|---|
protected BlockVector3 |
position1 |
protected BlockVector3 |
position2 |
protected CuboidRegion |
region |
Constructor and Description |
---|
CuboidRegionSelector()
Create a new region selector with a
null world. |
CuboidRegionSelector(RegionSelector oldSelector)
Create a copy of another selector.
|
CuboidRegionSelector(World world)
Create a new region selector.
|
CuboidRegionSelector(World world,
BlockVector3 position1,
BlockVector3 position2)
Create a new region selector with the given two positions.
|
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.
|
CuboidRegion |
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.
|
CuboidRegion |
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 transient BlockVector3 position1
protected transient BlockVector3 position2
protected transient CuboidRegion region
public CuboidRegionSelector()
null
world.public CuboidRegionSelector(@Nullable World world)
world
- the world, which may be null
public CuboidRegionSelector(RegionSelector oldSelector)
oldSelector
- another selectorpublic CuboidRegionSelector(@Nullable World world, BlockVector3 position1, BlockVector3 position2)
world
- the worldposition1
- position 1position2
- position 2@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 boolean isDefined()
RegionSelector
isDefined
in interface RegionSelector
public CuboidRegion getRegion() throws IncompleteRegionException
RegionSelector
getRegion
in interface RegionSelector
IncompleteRegionException
- thrown if a region has not been fully definedpublic CuboidRegion getIncompleteRegion()
RegionSelector
getIncompleteRegion
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