public class LocalSession
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
MAX_HISTORY_SIZE |
Constructor and Description |
---|
LocalSession()
Construct the object.
|
LocalSession(LocalConfiguration config)
Construct the object.
|
Modifier and Type | Method and Description |
---|---|
void |
clearHistory()
Clear history.
|
boolean |
compareAndResetDirty()
Get whether this session is "dirty" and has changes that needs to
be committed, and reset it to
false . |
EditSession |
createEditSession(LocalPlayer player)
Deprecated.
|
EditSession |
createEditSession(Player player)
Construct a new edit session.
|
void |
describeCUI(Actor actor)
Describe the selection to the CUI actor.
|
java.util.Calendar |
detectDate(java.lang.String input)
Detect date from a user's input.
|
void |
disableSuperPickAxe()
Disable super pick axe.
|
void |
dispatchCUIEvent(Actor actor,
CUIEvent event)
Dispatch a CUI event but only if the actor has CUI support.
|
void |
dispatchCUISelection(Actor actor)
Send the selection information.
|
void |
dispatchCUISetup(Actor actor)
Dispatch the initial setup CUI messages.
|
void |
enableSuperPickAxe()
Enable super pick axe.
|
BlockBag |
getBlockBag(Player player)
Get a block bag for a player.
|
int |
getBlockChangeLimit()
Get the maximum number of blocks that can be changed in an edit session.
|
BrushTool |
getBrushTool(int item)
Get the brush tool assigned to the item.
|
ClipboardHolder |
getClipboard()
Gets the clipboard.
|
int |
getCUIVersion()
Gets the client's CUI protocol version
|
RegionSelectorType |
getDefaultRegionSelector()
Get the default region selector.
|
java.lang.String |
getLastScript()
Get the last script used.
|
Mask |
getMask()
Get the mask.
|
Vector |
getPlacementPosition(Player player)
Get the position use for commands that take a center point
(i.e.
|
Region |
getRegion()
Deprecated.
|
RegionSelector |
getRegionSelector()
Deprecated.
|
RegionSelector |
getRegionSelector(LocalWorld world)
Deprecated.
|
RegionSelector |
getRegionSelector(World world)
Get the region selector for defining the selection.
|
Region |
getSelection(LocalWorld world)
Deprecated.
|
Region |
getSelection(World world)
Get the selection region.
|
World |
getSelectionWorld()
Get the selection world.
|
Snapshot |
getSnapshot()
Get the snapshot that has been selected.
|
BlockTool |
getSuperPickaxe()
Get the assigned block tool.
|
java.util.TimeZone |
getTimeZone()
Get the session's timezone.
|
Tool |
getTool(int item)
Get the tool assigned to the item.
|
void |
handleCUIInitializationMessage(java.lang.String text)
Handle a CUI initialization message.
|
boolean |
hasCUISupport()
Gets the status of CUI support.
|
boolean |
hasFastMode()
Checks if the session has fast mode enabled.
|
boolean |
hasSuperPickAxe()
Checks whether the super pick axe is enabled.
|
boolean |
isDirty()
Get whether this session is "dirty" and has changes that needs to
be committed.
|
boolean |
isRegionDefined()
Deprecated.
|
boolean |
isSelectionDefined(LocalWorld world)
Deprecated.
|
boolean |
isSelectionDefined(World world)
Returns true if the region is fully defined for the specified world.
|
boolean |
isToolControlEnabled()
See if tool control is enabled.
|
boolean |
isUsingInventory()
Returns whether inventory usage is enabled for this session.
|
void |
postLoad()
Called on post load of the session from persistent storage.
|
EditSession |
redo(BlockBag newBlockBag,
LocalPlayer player)
Performs a redo
|
EditSession |
redo(BlockBag newBlockBag,
Player player)
Performs a redo
|
void |
remember(EditSession editSession)
Remember an edit session for the undo history.
|
void |
setBlockChangeLimit(int maxBlocksChanged)
Set the maximum number of blocks that can be changed.
|
void |
setClipboard(ClipboardHolder clipboard)
Sets the clipboard.
|
void |
setConfiguration(LocalConfiguration config)
Set the configuration.
|
void |
setCUISupport(boolean support)
Sets the status of CUI support.
|
void |
setCUIVersion(int cuiVersion)
Sets the client's CUI protocol version
|
void |
setDefaultRegionSelector(RegionSelectorType defaultSelector)
Set the default region selector.
|
void |
setFastMode(boolean fastMode)
Set fast mode.
|
void |
setLastScript(java.lang.String lastScript)
Set the last script used.
|
void |
setMask(Mask mask)
Set a mask.
|
void |
setMask(Mask mask)
Set a mask.
|
void |
setRegionSelector(LocalWorld world,
RegionSelector selector)
Deprecated.
|
void |
setRegionSelector(World world,
RegionSelector selector)
Set the region selector.
|
void |
setSnapshot(Snapshot snapshot)
Select a snapshot.
|
void |
setSuperPickaxe(BlockTool tool)
Set the super pick axe tool.
|
void |
setTimezone(java.util.TimeZone timezone)
Set the session's timezone.
|
void |
setTool(int item,
Tool tool)
Set the tool.
|
void |
setToolControl(boolean toolControl)
Change tool control setting.
|
void |
setUseInventory(boolean useInventory)
Set the state of inventory usage.
|
void |
tellVersion(Actor player)
Tell the player the WorldEdit version.
|
boolean |
togglePlacementPosition()
Toggle placement position.
|
boolean |
toggleSuperPickAxe()
Toggle the super pick axe.
|
EditSession |
undo(BlockBag newBlockBag,
LocalPlayer player)
Performs an undo.
|
EditSession |
undo(BlockBag newBlockBag,
Player player)
Performs an undo.
|
public LocalSession()
setConfiguration(LocalConfiguration)
should be called
later with configuration.
public LocalSession(@Nullable LocalConfiguration config)
config
- the configurationpublic void setConfiguration(LocalConfiguration config)
config
- the configurationpublic void postLoad()
public boolean isDirty()
public boolean compareAndResetDirty()
false
.true
public java.util.TimeZone getTimeZone()
public void setTimezone(java.util.TimeZone timezone)
timezone
- the user's timezonepublic void clearHistory()
public void remember(EditSession editSession)
editSession
- the edit sessionpublic EditSession undo(@Nullable BlockBag newBlockBag, LocalPlayer player)
newBlockBag
- a new block bagplayer
- the playerpublic EditSession undo(@Nullable BlockBag newBlockBag, Player player)
newBlockBag
- a new block bagplayer
- the playerpublic EditSession redo(@Nullable BlockBag newBlockBag, LocalPlayer player)
newBlockBag
- a new block bagplayer
- the playerpublic EditSession redo(@Nullable BlockBag newBlockBag, Player player)
newBlockBag
- a new block bagplayer
- the playerpublic RegionSelectorType getDefaultRegionSelector()
public void setDefaultRegionSelector(RegionSelectorType defaultSelector)
defaultSelector
- the default region selector@Deprecated public RegionSelector getRegionSelector(LocalWorld world)
getRegionSelector(World)
public RegionSelector getRegionSelector(World world)
world
- the world@Deprecated public RegionSelector getRegionSelector()
getRegionSelector(World)
@Deprecated public void setRegionSelector(LocalWorld world, RegionSelector selector)
setRegionSelector(World, RegionSelector)
public void setRegionSelector(World world, RegionSelector selector)
world
- the worldselector
- the selector@Deprecated public boolean isRegionDefined()
@Deprecated public boolean isSelectionDefined(LocalWorld world)
isSelectionDefined(World)
public boolean isSelectionDefined(World world)
world
- the world@Deprecated public Region getRegion() throws IncompleteRegionException
getSelection(World)
IncompleteRegionException
@Deprecated public Region getSelection(LocalWorld world) throws IncompleteRegionException
getSelection(World)
IncompleteRegionException
public Region getSelection(World world) throws IncompleteRegionException
IncompleteRegionException
exception will be thrown.world
- the worldIncompleteRegionException
- if no region is selectedpublic World getSelectionWorld()
public ClipboardHolder getClipboard() throws EmptyClipboardException
EmptyClipboardException
- thrown if no clipboard is setpublic void setClipboard(@Nullable ClipboardHolder clipboard)
Pass null
to clear the clipboard.
clipboard
- the clipboard, or null if the clipboard is to be clearedpublic boolean isToolControlEnabled()
public void setToolControl(boolean toolControl)
toolControl
- true to enable tool controlpublic int getBlockChangeLimit()
public void setBlockChangeLimit(int maxBlocksChanged)
maxBlocksChanged
- the maximum number of blocks changedpublic boolean hasSuperPickAxe()
public void enableSuperPickAxe()
public void disableSuperPickAxe()
public boolean toggleSuperPickAxe()
public Vector getPlacementPosition(Player player) throws IncompleteRegionException
player
- the playerIncompleteRegionException
- thrown if a region is not fully selectedpublic boolean togglePlacementPosition()
@Nullable public BlockBag getBlockBag(Player player)
player
- the player to get the block bag for@Nullable public Snapshot getSnapshot()
public void setSnapshot(@Nullable Snapshot snapshot)
snapshot
- a snapshotpublic BlockTool getSuperPickaxe()
public void setSuperPickaxe(BlockTool tool)
tool
- the tool to set@Nullable public Tool getTool(int item)
item
- the item type IDnull
public BrushTool getBrushTool(int item) throws InvalidToolBindException
item
- the item type IDnull
InvalidToolBindException
- if the item can't be bound to that itempublic void setTool(int item, @Nullable Tool tool) throws InvalidToolBindException
item
- the item type IDtool
- the tool to set, which can be null
InvalidToolBindException
- if the item can't be bound to that itempublic boolean isUsingInventory()
public void setUseInventory(boolean useInventory)
useInventory
- if inventory is to be used@Nullable public java.lang.String getLastScript()
public void setLastScript(@Nullable java.lang.String lastScript)
lastScript
- the last script's namepublic void tellVersion(Actor player)
player
- the playerpublic void dispatchCUIEvent(Actor actor, CUIEvent event)
actor
- the actorevent
- the eventpublic void dispatchCUISetup(Actor actor)
actor
- the actorpublic void dispatchCUISelection(Actor actor)
actor
- the actorpublic void describeCUI(Actor actor)
actor
- the actorpublic void handleCUIInitializationMessage(java.lang.String text)
text
- the messagepublic boolean hasCUISupport()
public void setCUISupport(boolean support)
support
- true if CUI is enabledpublic int getCUIVersion()
public void setCUIVersion(int cuiVersion)
cuiVersion
- the CUI version@Nullable public java.util.Calendar detectDate(java.lang.String input)
input
- the input to parse@Deprecated public EditSession createEditSession(LocalPlayer player)
createEditSession(Player)
public EditSession createEditSession(Player player)
player
- the playerpublic boolean hasFastMode()
public void setFastMode(boolean fastMode)
fastMode
- true if fast mode is enabledpublic Mask getMask()
public void setMask(Mask mask)
mask
- mask or nullpublic void setMask(Mask mask)
mask
- mask or null