Package me.c7dev.dexterity
Class DexSession
java.lang.Object
me.c7dev.dexterity.DexSession
Holds a player's in-game command state and transaction history
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionDexSession
(org.bukkit.entity.Player player, me.c7dev.dexterity.Dexterity plugin) Initializes a new session for a player -
Method Summary
Modifier and TypeMethodDescriptionvoid
Removes player from any edit session and restore to previous statevoid
Deletes the edit history, removing any undo or redo transactionsvoid
void
clickMsg()
Simple function to send the default click message for a saved displayvoid
Completes the edit sessionorg.joml.Vector3f
org.bukkit.util.Vector
org.bukkit.Location
Retrieves first location set by playerorg.bukkit.Location
Retrieves second location set by playergetMask()
double
Returns the largest volume defined by the dexterity.maxvolume.# permissionorg.bukkit.entity.Player
double
Returns the number ofDexBlock
in the selectiondouble
Returns the number of blocks of volume between 2 locations cuboiddouble
Returns the max between number of entities and volume between 2 locationsorg.bukkit.World
getWorld()
boolean
Returns true if locations are set and valid.boolean
Gets whether the blocks between the 2 locations have physics updatesboolean
Returns true if the selection is following the player, such as in a translation editboolean
void
Adds a modified block to the workingBuildTransaction
void
Adds an edit transaction to the stackvoid
redo()
Executes 1 redovoid
redo
(int count) Executes a number of redo(s)void
void
setCancelPhysics
(boolean b) Sets whether the blocks between the 2 locations have physics updatesvoid
setContinuousLocation
(org.bukkit.Location loc, boolean is_l1, org.bukkit.util.Vector scale_offset, boolean msg) Precisely sets the first or second locationvoid
setEditingScale
(org.joml.Vector3f scale) void
setFollowingOffset
(org.bukkit.util.Vector v) void
setLocation
(org.bukkit.Location loc, boolean is_l1) Sets the first or second location to a blockvoid
setLocation
(org.bukkit.Location loc, boolean is_l1, boolean msg) Sets the first or second location to a blockvoid
void
setSelected
(DexterityDisplay o, boolean msg) Changes the player's selectionvoid
void
startEdit
(DexterityDisplay d, DexSession.EditType type, boolean swap) Enters the player into an edit sessionvoid
startEdit
(DexterityDisplay d, DexSession.EditType type, boolean swap, Transaction t) Enters the player into an edit sessionvoid
void
void
undo()
Executes 1 undovoid
undo
(int count) Executes a number of undo(s)void
-
Constructor Details
-
DexSession
public DexSession(org.bukkit.entity.Player player, me.c7dev.dexterity.Dexterity plugin) Initializes a new session for a player- Parameters:
player
-plugin
-
-
-
Method Details
-
getLocation1
public org.bukkit.Location getLocation1()Retrieves first location set by player- Returns:
-
getLocation2
public org.bukkit.Location getLocation2()Retrieves second location set by player- Returns:
-
getEditingScale
public org.joml.Vector3f getEditingScale() -
setEditingScale
public void setEditingScale(org.joml.Vector3f scale) -
getPlayer
public org.bukkit.entity.Player getPlayer() -
getMask
-
getSelected
-
getSecondary
-
isCancellingPhysics
public boolean isCancellingPhysics()Gets whether the blocks between the 2 locations have physics updates- Returns:
- true if block physics events should be cancelled
-
setCancelPhysics
public void setCancelPhysics(boolean b) Sets whether the blocks between the 2 locations have physics updates- Parameters:
b
-
-
setSelected
Changes the player's selection- Parameters:
o
- The new selection, or null for no selectionmsg
- true if the player should be notified in chat
-
isFollowing
public boolean isFollowing()Returns true if the selection is following the player, such as in a translation edit- Returns:
- See Also:
-
startFollowing
public void startFollowing() -
stopFollowing
public void stopFollowing() -
getFollowingOffset
public org.bukkit.util.Vector getFollowingOffset() -
setFollowingOffset
public void setFollowingOffset(org.bukkit.util.Vector v) -
clearHistory
public void clearHistory()Deletes the edit history, removing any undo or redo transactions -
pushTransaction
Adds an edit transaction to the stack- Parameters:
t
-
-
pushBlock
Adds a modified block to the workingBuildTransaction
- Parameters:
db
-placing
- true if player is placing theDexBlock
, false if breaking
-
undo
public void undo()Executes 1 undo -
undo
public void undo(int count) Executes a number of undo(s)- Parameters:
count
- The number of undos to execute
-
redo
public void redo()Executes 1 redo -
redo
public void redo(int count) Executes a number of redo(s)- Parameters:
count
- The number of redos to execute
-
startEdit
Enters the player into an edit session- Parameters:
d
- The new selection to set as primarytype
-swap
- If true and there exists a selection already, current selection will be reselected after edit session is over
-
startEdit
Enters the player into an edit session- Parameters:
d
- The new selection to set as primarytype
-swap
- If true and there exists a selection already, current selection will be reselected after edit session is overt
- Transaction to commit any blocks to during edit session
-
cancelEdit
public void cancelEdit()Removes player from any edit session and restore to previous state -
finishEdit
public void finishEdit()Completes the edit session -
getEditType
-
getWorld
public org.bukkit.World getWorld() -
getSelectionVolume
public double getSelectionVolume()Returns the max between number of entities and volume between 2 locations- Returns:
-
hasLocationsSet
public boolean hasLocationsSet()Returns true if locations are set and valid.- Returns:
-
clickMsg
public void clickMsg()Simple function to send the default click message for a saved display -
getSelectedVolumeSpace
public double getSelectedVolumeSpace()Returns the number of blocks of volume between 2 locations cuboid- Returns:
-
getPermittedVolume
public double getPermittedVolume()Returns the largest volume defined by the dexterity.maxvolume.# permission- Returns:
- Min of configured max volume and volume from permissions
-
getSelectedVolumeCount
public double getSelectedVolumeCount()Returns the number ofDexBlock
in the selection- Returns:
- Integer count of blocks or 0 if nothing selected
-
setLocation
public void setLocation(org.bukkit.Location loc, boolean is_l1) Sets the first or second location to a block- Parameters:
loc
-is_l1
- true if setting the first location
-
setLocation
public void setLocation(org.bukkit.Location loc, boolean is_l1, boolean msg) Sets the first or second location to a block- Parameters:
loc
-is_l1
- true if setting the first locationmsg
- true if player should be notified in chat
-
setContinuousLocation
public void setContinuousLocation(org.bukkit.Location loc, boolean is_l1, org.bukkit.util.Vector scale_offset, boolean msg) Precisely sets the first or second location- Parameters:
loc
-is_l1
- true if setting the first locationscale_offset
- The offset added to the minimum or maximum coordinate once both locations are setmsg
- true if player should be notified in chat
-
setShowingAxes
-
isShowingAxes
public boolean isShowingAxes() -
getShowingAxisType
-
updateAxisDisplays
public void updateAxisDisplays() -
removeAxes
public void removeAxes() -
setMask
-
clearLocationSelection
public void clearLocationSelection()
-