Class DexterityAPI

java.lang.Object
me.c7dev.dexterity.api.DexterityAPI

public class DexterityAPI extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    DexterityAPI(me.c7dev.dexterity.Dexterity plugin)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deletes all marker points and marker vectors
    Creates a clone of the passed in display or selection and returns the clone.
    convertBlocks(org.bukkit.Location l1, org.bukkit.Location l2)
    Converts all of the blocks inside the cuboid defined by the two locations into Block Displays
    convertBlocks(org.bukkit.Location l1, org.bukkit.Location l2, ConvertTransaction t)
    Converts all of the blocks inside the cuboid defined by the two locations into Block Displays
    convertBlocks(org.bukkit.Location l1, org.bukkit.Location l2, ConvertTransaction t, int limit)
    Converts all of the blocks inside the cuboid defined by the two locations into Block Displays
     
    List<org.bukkit.entity.BlockDisplay>
    getBlockDisplaysInRegion(org.bukkit.Location l1r, org.bukkit.Location l2r)
    Retrieves all of the block display entities within the cuboid defined by the two integer block locations
    List<org.bukkit.entity.BlockDisplay>
    getBlockDisplaysInRegionContinuous(org.bukkit.Location l1r, org.bukkit.Location l2r, org.bukkit.util.Vector l1o, org.bukkit.util.Vector l2o)
    Retrieves all of the block display entities within the precise cuboid defined by the two continuous locations
    Retrieves a saved DexterityDisplay in any world by its raw label name
    Returns all names of displays that are saved across all worlds
    Returns all displays that have been saved across all worlds
     
    getLookingAt(org.bukkit.entity.Player p)
    Calculates the precise block display entity that the player is currently looking at with their cursor
    getPhysicalBlockLookingAt(org.bukkit.entity.Player p)
    Calculates the precise placed block that the player is currently looking at with their cursor
    getPhysicalBlockLookingAtRaw(org.bukkit.entity.Player p, double step_multiplier, double max_dist)
    Calculates the precise placed block that the player is currently looking at with their cursor
    Retrieves the edit session for the player with the specified UUID.
    getSession(org.bukkit.entity.Player p)
    Retrieves the specified player's edit session if it exists
    boolean
    Check if the UUID of a block display is a marker point that will be removed in the future.
    org.bukkit.entity.BlockDisplay
    markerPoint(org.bukkit.Location loc, org.bukkit.Color glow, int seconds)
    Creates a very small block display with a glow to illustrate a location with precision.
    org.bukkit.entity.BlockDisplay[]
    markerVector(org.bukkit.Location from_loc, org.bukkit.Location to_loc, org.bukkit.Color glow, int seconds)
    Creates a small block display between the from_loc to the to_loc with precision.
    org.bukkit.entity.BlockDisplay[]
    markerVector(org.bukkit.Location from_loc, org.bukkit.Location to_loc, org.bukkit.Material mat, org.bukkit.Color glow, int seconds)
    Creates a small block display between the from_loc to the to_loc with precision.
    org.bukkit.entity.BlockDisplay[]
    markerVector(org.bukkit.Location from_loc, org.bukkit.util.Vector delta, org.bukkit.Color glow, int seconds)
    Creates a small block display between from_loc and a second location defined by a vector offset.
    org.bukkit.entity.BlockDisplay[]
    markerVector(org.bukkit.Location from_loc, org.bukkit.util.Vector delta, org.bukkit.Material mat, org.bukkit.Color glow, int seconds)
    Creates a small block display between from_loc and a second location defined by a vector offset.
    void
    removeMarker(org.bukkit.entity.BlockDisplay b)
    Removes a marker point before the timer expires
    void
    removeMarker(org.bukkit.entity.BlockDisplay[] v)
    Removes a marker vector before the timer expires
    selectFromLocations(org.bukkit.Location l1, org.bukkit.Location l2)
    Create a new DexterityDisplay of valid block displays within the precise cuboid defined by the two locations.
    selectFromLocations(org.bukkit.Location l1, org.bukkit.Location l2, Mask mask)
    Create a new DexterityDisplay of valid block displays within the precise cuboid defined by the two locations.
    selectFromLocations(org.bukkit.Location l1, org.bukkit.Location l2, Mask mask, org.bukkit.util.Vector l1_scale_offset, org.bukkit.util.Vector l2_scale_offset)
    Create a new DexterityDisplay of valid block displays within the precise cuboid defined by the two locations.
    void
    Temporarily makes a DexterityDisplay glow for a period of time if it is not glowing already.
    void
    tempHighlight(DexterityDisplay d, int ticks, org.bukkit.Color c)
    Temporarily makes a DexterityDisplay glow for a period of time if it is not glowing already.
    void
    tempHighlight(org.bukkit.entity.BlockDisplay block, int ticks, org.bukkit.Color c)
    Temporarily makes a block display glow for a period of time if it is not glowing already.
    void
    Undo any temporarily glow for a selection.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DexterityAPI

      public DexterityAPI(me.c7dev.dexterity.Dexterity plugin)
  • Method Details

    • getInstance

      public static DexterityAPI getInstance()
    • getDisplayLabels

      public Set<String> getDisplayLabels()
      Returns all names of displays that are saved across all worlds
      Returns:
      Unmodifiable set of label strings
    • getDisplays

      public Collection<DexterityDisplay> getDisplays()
      Returns all displays that have been saved across all worlds
      Returns:
      Unmodifiable collection of DexterityDisplay that have been saved
    • getDisplay

      public DexterityDisplay getDisplay(String label)
      Retrieves a saved DexterityDisplay in any world by its raw label name
      Parameters:
      label - Label of the saved display
      Returns:
      The saved display if it exists, otherwise null
    • getSession

      public DexSession getSession(org.bukkit.entity.Player p)
      Retrieves the specified player's edit session if it exists
      Parameters:
      p - The online player whose session is to be retrieved
      Returns:
      The player's session if it exists, otherwise null
    • getSession

      public DexSession getSession(UUID u)
      Retrieves the edit session for the player with the specified UUID. Can be used if the player is offline but the session has not been automatically deleted yet.
      Parameters:
      u - The UUID of the player whose session is to be retrieved
      Returns:
      The edit session of the player with the specified UUID if it exists, otherwise null
    • convertBlocks

      public DexterityDisplay convertBlocks(org.bukkit.Location l1, org.bukkit.Location l2)
      Converts all of the blocks inside the cuboid defined by the two locations into Block Displays
      Parameters:
      l1 - First location
      l2 - Second location
      Returns:
      A DexterityDisplay selection of the newly created block displays
    • convertBlocks

      public DexterityDisplay convertBlocks(org.bukkit.Location l1, org.bukkit.Location l2, ConvertTransaction t)
      Converts all of the blocks inside the cuboid defined by the two locations into Block Displays
      Parameters:
      l1 - First location
      l2 - Second location
      Returns:
      A DexterityDisplay selection of the newly created block displays
    • convertBlocks

      public DexterityDisplay convertBlocks(org.bukkit.Location l1, org.bukkit.Location l2, ConvertTransaction t, int limit)
      Converts all of the blocks inside the cuboid defined by the two locations into Block Displays
      Parameters:
      l1 - First location
      l2 - Second location
      t - Transaction to add blocks
      limit - Maximum number to convert for safety
      Returns:
      A DexterityDisplay selection of the newly created block displays
    • getLookingAt

      public ClickedBlockDisplay getLookingAt(org.bukkit.entity.Player p)
      Calculates the precise block display entity that the player is currently looking at with their cursor
      Parameters:
      p -
      Returns:
      Unmodifiable data object containing the entity, entity's center, block face, location on the block face, and basis vectors.
    • getPhysicalBlockLookingAt

      public ClickedBlock getPhysicalBlockLookingAt(org.bukkit.entity.Player p)
      Calculates the precise placed block that the player is currently looking at with their cursor
      Parameters:
      p -
      Returns:
      Unmodifiable data object containing the block and distance (in block units) away.
    • getPhysicalBlockLookingAtRaw

      public ClickedBlock getPhysicalBlockLookingAtRaw(org.bukkit.entity.Player p, double step_multiplier, double max_dist)
      Calculates the precise placed block that the player is currently looking at with their cursor
      Parameters:
      p -
      step_multiplier - Defines the step size, and thus the precision to check
      max_dist - Defines the maximum radius, in blocks, to search
      Returns:
      Unmodifiable data object containing the block and distance (in block units) away.
    • clone

      Creates a clone of the passed in display or selection and returns the clone. Does not merge the new clone.
      Parameters:
      d - The display or selection to clone
    • markerPoint

      public org.bukkit.entity.BlockDisplay markerPoint(org.bukkit.Location loc, org.bukkit.Color glow, int seconds)
      Creates a very small block display with a glow to illustrate a location with precision. Useful for debugging or verifying location variables.
      Parameters:
      loc -
      glow - The color of the marker point
      seconds - The number of seconds until the marker point is removed, negative if permanent
      Returns:
      The BlockDisplay of the created marker point
    • markerVector

      public org.bukkit.entity.BlockDisplay[] markerVector(org.bukkit.Location from_loc, org.bukkit.util.Vector delta, org.bukkit.Material mat, org.bukkit.Color glow, int seconds)
      Creates a small block display between from_loc and a second location defined by a vector offset. Useful for debugging or verifying location variables.
      Parameters:
      from_loc -
      delta -
      mat - Required material type
      glow - The color of the vector
      seconds - The number of seconds until marker vector is removed, negative if permanent
      Returns:
      The BlockDisplays used in the created marker vector, formatted as {body, head}
    • markerVector

      public org.bukkit.entity.BlockDisplay[] markerVector(org.bukkit.Location from_loc, org.bukkit.util.Vector delta, org.bukkit.Color glow, int seconds)
      Creates a small block display between from_loc and a second location defined by a vector offset. Useful for debugging or verifying location variables.
      Parameters:
      from_loc -
      delta -
      glow - The color of the vector
      seconds - The number of seconds until marker vector is removed, negative if permanent
      Returns:
      The BlockDisplays used in the created marker vector, formatted as {body, head}
    • markerVector

      public org.bukkit.entity.BlockDisplay[] markerVector(org.bukkit.Location from_loc, org.bukkit.Location to_loc, org.bukkit.Color glow, int seconds)
      Creates a small block display between the from_loc to the to_loc with precision. Useful for debugging or verifying location variables.
      Parameters:
      from_loc -
      to_loc -
      glow - The color of the vector
      seconds - The number of seconds until marker vector is removed, negative if permanent
      Returns:
      The BlockDisplays used in the created marker vector, formatted as {body, head}
    • markerVector

      public org.bukkit.entity.BlockDisplay[] markerVector(org.bukkit.Location from_loc, org.bukkit.Location to_loc, org.bukkit.Material mat, org.bukkit.Color glow, int seconds)
      Creates a small block display between the from_loc to the to_loc with precision. Useful for debugging or verifying location variables.
      Parameters:
      from_loc -
      to_loc -
      mat - Required material type
      glow - The color of the vector
      seconds - The number of seconds until marker vector is removed, negative if permanent
      Returns:
      The BlockDisplays used in the created marker vector, formatted as {body, head}
    • removeMarker

      public void removeMarker(org.bukkit.entity.BlockDisplay b)
      Removes a marker point before the timer expires
      Parameters:
      b - Marker point block display entity
    • removeMarker

      public void removeMarker(org.bukkit.entity.BlockDisplay[] v)
      Removes a marker vector before the timer expires
      Parameters:
      v - Marker point block display entity
    • clearAllMarkers

      public void clearAllMarkers()
      Deletes all marker points and marker vectors
    • getAuthor

      public String getAuthor()
    • tempHighlight

      public void tempHighlight(DexterityDisplay d, int ticks)
      Temporarily makes a DexterityDisplay glow for a period of time if it is not glowing already. Helpful for debugging or to visualize a selection.
      Parameters:
      d -
      ticks - The number of ticks (0.05 of a second) until the highlighting is reset.
    • tempHighlight

      public void tempHighlight(DexterityDisplay d, int ticks, org.bukkit.Color c)
      Temporarily makes a DexterityDisplay glow for a period of time if it is not glowing already. Helpful for debugging or to visualize a selection.
      Parameters:
      d -
      ticks - The number of ticks (0.05 of a second) until the highlighting is reset.
      c - The glow color to highlight with
    • tempHighlight

      public void tempHighlight(org.bukkit.entity.BlockDisplay block, int ticks, org.bukkit.Color c)
      Temporarily makes a block display glow for a period of time if it is not glowing already. Helpful for debugging or to visualize a selection.
      Parameters:
      block - The block display to highlight with
      ticks - The number of ticks (0.05 of a second) until the highlighting is reset.
      c - The color to highlight with.
    • unTempHighlight

      public void unTempHighlight(DexterityDisplay d)
      Undo any temporarily glow for a selection.
      Parameters:
      d - The selection or display to remove temporary highlighting from
    • isInProcess

      public boolean isInProcess(UUID u)
      Check if the UUID of a block display is a marker point that will be removed in the future. Used to check that a repeating process does not go into an infinite loop if it can create marker points.
      Parameters:
      u -
      Returns:
      true if the entity with that UUID is a marker point or otherwise will be removed in the near future.
    • getBlockDisplaysInRegion

      public List<org.bukkit.entity.BlockDisplay> getBlockDisplaysInRegion(org.bukkit.Location l1r, org.bukkit.Location l2r)
      Retrieves all of the block display entities within the cuboid defined by the two integer block locations
      Parameters:
      l1r - The first block location
      l2r - The second block location
      Returns:
      Unmodifiable list of Block Display entities that are within the cuboid
    • getBlockDisplaysInRegionContinuous

      public List<org.bukkit.entity.BlockDisplay> getBlockDisplaysInRegionContinuous(org.bukkit.Location l1r, org.bukkit.Location l2r, org.bukkit.util.Vector l1o, org.bukkit.util.Vector l2o)
      Retrieves all of the block display entities within the precise cuboid defined by the two continuous locations
      Parameters:
      l1r - The first location
      l2r - The second location
      l1o - The offset added to the minimum of the coordinates
      l2o - The offset added to the maximum of the coordinates
      Returns:
      Unmodifiable list of Block Display entities that are within the cuboid
    • selectFromLocations

      public DexterityDisplay selectFromLocations(org.bukkit.Location l1, org.bukkit.Location l2)
      Create a new DexterityDisplay of valid block displays within the precise cuboid defined by the two locations. Equivalent to using the wand to select in-game.
      Parameters:
      l1 - The first location
      l2 - The second location
      Returns:
      A new DexterityDisplay representing the selection made by the two locations.
    • selectFromLocations

      public DexterityDisplay selectFromLocations(org.bukkit.Location l1, org.bukkit.Location l2, Mask mask)
      Create a new DexterityDisplay of valid block displays within the precise cuboid defined by the two locations. Equivalent to using the wand to select in-game.
      Parameters:
      l1 - The first location
      l2 - The second location
      mask - A mask to use, or null for no mask
      Returns:
      A new DexterityDisplay representing the selection made by the two locations.
    • selectFromLocations

      public DexterityDisplay selectFromLocations(org.bukkit.Location l1, org.bukkit.Location l2, Mask mask, org.bukkit.util.Vector l1_scale_offset, org.bukkit.util.Vector l2_scale_offset)
      Create a new DexterityDisplay of valid block displays within the precise cuboid defined by the two locations. Equivalent to using the wand to select in-game.
      Parameters:
      l1 - The first location
      l2 - The second location
      mask - A mask to use, or null for no mask
      l1_scale_offset - The offset added to the minimum of the coordinates
      l2_scale_offset - The offset added to the maximum of the coordinates
      Returns:
      A new DexterityDisplay representing the selection made by the two locations.