Class DexSession

java.lang.Object
me.c7dev.dexterity.DexSession

public class DexSession extends Object
Holds a player's in-game command state and transaction history
  • 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

      public Mask getMask()
    • getSelected

      public DexterityDisplay getSelected()
    • getSecondary

      public DexterityDisplay 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

      public void setSelected(DexterityDisplay o, boolean msg)
      Changes the player's selection
      Parameters:
      o - The new selection, or null for no selection
      msg - 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

      public void pushTransaction(Transaction t)
      Adds an edit transaction to the stack
      Parameters:
      t -
    • pushBlock

      public void pushBlock(DexBlock db, boolean placing)
      Adds a modified block to the working BuildTransaction
      Parameters:
      db -
      placing - true if player is placing the DexBlock, 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

      public void startEdit(DexterityDisplay d, DexSession.EditType type, boolean swap)
      Enters the player into an edit session
      Parameters:
      d - The new selection to set as primary
      type -
      swap - If true and there exists a selection already, current selection will be reselected after edit session is over
    • startEdit

      public void startEdit(DexterityDisplay d, DexSession.EditType type, boolean swap, Transaction t)
      Enters the player into an edit session
      Parameters:
      d - The new selection to set as primary
      type -
      swap - If true and there exists a selection already, current selection will be reselected after edit session is over
      t - 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

      public DexSession.EditType 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 of DexBlock 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 location
      msg - 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 location
      scale_offset - The offset added to the minimum or maximum coordinate once both locations are set
      msg - true if player should be notified in chat
    • setShowingAxes

      public void setShowingAxes(DexSession.AxisType a)
    • isShowingAxes

      public boolean isShowingAxes()
    • getShowingAxisType

      public DexSession.AxisType getShowingAxisType()
    • updateAxisDisplays

      public void updateAxisDisplays()
    • removeAxes

      public void removeAxes()
    • setMask

      public void setMask(Mask mask)
    • clearLocationSelection

      public void clearLocationSelection()