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
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionDexSession(org.bukkit.entity.Player player, Dexterity plugin) Initializes a new session for a player -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves player from any edit session and restore to previous statevoidDeletes the edit history, removing any undo or redo transactionsvoidvoidclickMsg()Simple function to send the default click message for a saved displayvoidCompletes the edit sessionorg.joml.Vector3forg.bukkit.util.Vectororg.bukkit.LocationRetrieves first location set by playerorg.bukkit.LocationRetrieves second location set by playergetMask()doubleReturns the largest volume defined by the dexterity.maxvolume.# permissionorg.bukkit.entity.PlayerdoubleReturns the number ofDexBlockin the selectiondoubleReturns the number of blocks of volume between 2 locations cuboiddoubleReturns the max between number of entities and volume between 2 locationsorg.bukkit.WorldgetWorld()booleanReturns true if locations are set and valid.booleanGets whether the blocks between the 2 locations have physics updatesbooleanReturns true if the selection is following the player, such as in a translation editbooleanvoidAdds a modified block to the workingBuildTransactionvoidAdds an edit transaction to the stackvoidredo()Executes 1 redovoidredo(int count) Executes a number of redo(s)voidvoidsetCancelPhysics(boolean b) Sets whether the blocks between the 2 locations have physics updatesvoidsetContinuousLocation(org.bukkit.Location loc, boolean isL1, org.bukkit.util.Vector scaleOffset, boolean verbose) Precisely sets the first or second locationvoidsetEditingScale(org.joml.Vector3f scale) voidsetFollowingOffset(org.bukkit.util.Vector v) voidsetLocation(org.bukkit.Location loc, boolean isL1) Sets the first or second location to a blockvoidsetLocation(org.bukkit.Location loc, boolean isL1, boolean verbose) Sets the first or second location to a blockvoidvoidsetSelected(DexterityDisplay o, boolean msg) Changes the player's selectionvoidvoidstartEdit(DexterityDisplay d, DexSession.EditType type, boolean swap) Enters the player into an edit sessionvoidstartEdit(DexterityDisplay d, DexSession.EditType type, boolean swap, Transaction t) Enters the player into an edit sessionvoidvoidvoidundo()Executes 1 undovoidundo(int count) Executes a number of undo(s)void
-
Constructor Details
-
DexSession
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 ofDexBlockin the selection- Returns:
- Integer count of blocks or 0 if nothing selected
-
setLocation
public void setLocation(org.bukkit.Location loc, boolean isL1) Sets the first or second location to a block- Parameters:
loc-isL1- true if setting the first location
-
setLocation
public void setLocation(org.bukkit.Location loc, boolean isL1, boolean verbose) Sets the first or second location to a block- Parameters:
loc-isL1- true if setting the first locationverbose- true if player should be notified in chat
-
setContinuousLocation
public void setContinuousLocation(org.bukkit.Location loc, boolean isL1, org.bukkit.util.Vector scaleOffset, boolean verbose) Precisely sets the first or second location- Parameters:
loc-isL1- true if setting the first locationscaleOffset- The offset added to the minimum or maximum coordinate once both locations are setverbose- 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()
-