Package me.c7dev.dexterity.api
Class DexterityAPI
java.lang.Object
me.c7dev.dexterity.api.DexterityAPI
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Deletes all marker points and marker vectorsCreates 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 DisplaysconvertBlocks
(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 DisplaysconvertBlocks
(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 DisplaysList<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 locationsList<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 locationsgetDisplay
(String label) Retrieves a savedDexterityDisplay
in any world by its raw label nameReturns all names of displays that are saved across all worldsReturns all displays that have been saved across all worldsstatic DexterityAPI
getLookingAt
(org.bukkit.entity.Player p) Calculates the precise block display entity that the player is currently looking at with their cursorgetPhysicalBlockLookingAt
(org.bukkit.entity.Player p) Calculates the precise placed block that the player is currently looking at with their cursorgetPhysicalBlockLookingAtRaw
(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 cursorgetSession
(UUID u) 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 existsboolean
isInProcess
(UUID u) 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 expiresvoid
removeMarker
(org.bukkit.entity.BlockDisplay[] v) Removes a marker vector before the timer expiresselectFromLocations
(org.bukkit.Location l1, org.bukkit.Location l2) Create a newDexterityDisplay
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 newDexterityDisplay
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 newDexterityDisplay
of valid block displays within the precise cuboid defined by the two locations.void
tempHighlight
(DexterityDisplay d, int ticks) Temporarily makes aDexterityDisplay
glow for a period of time if it is not glowing already.void
tempHighlight
(DexterityDisplay d, int ticks, org.bukkit.Color c) Temporarily makes aDexterityDisplay
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.
-
Constructor Details
-
DexterityAPI
public DexterityAPI(me.c7dev.dexterity.Dexterity plugin)
-
-
Method Details
-
getInstance
-
getDisplayLabels
Returns all names of displays that are saved across all worlds- Returns:
- Unmodifiable set of label strings
-
getDisplays
Returns all displays that have been saved across all worlds- Returns:
- Unmodifiable collection of
DexterityDisplay
that have been saved
-
getDisplay
Retrieves a savedDexterityDisplay
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
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
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
Converts all of the blocks inside the cuboid defined by the two locations into Block Displays- Parameters:
l1
- First locationl2
- 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 locationl2
- 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 locationl2
- Second locationt
- Transaction to add blockslimit
- Maximum number to convert for safety- Returns:
- A
DexterityDisplay
selection of the newly created block displays
-
getLookingAt
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
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 checkmax_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 pointseconds
- 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 typeglow
- The color of the vectorseconds
- 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 vectorseconds
- 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 vectorseconds
- 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 typeglow
- The color of the vectorseconds
- 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
-
tempHighlight
Temporarily makes aDexterityDisplay
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
Temporarily makes aDexterityDisplay
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 withticks
- The number of ticks (0.05 of a second) until the highlighting is reset.c
- The color to highlight with.
-
unTempHighlight
Undo any temporarily glow for a selection.- Parameters:
d
- The selection or display to remove temporary highlighting from
-
isInProcess
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 locationl2r
- 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 locationl2r
- The second locationl1o
- The offset added to the minimum of the coordinatesl2o
- The offset added to the maximum of the coordinates- Returns:
- Unmodifiable list of Block Display entities that are within the cuboid
-
selectFromLocations
Create a newDexterityDisplay
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 locationl2
- 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 newDexterityDisplay
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 locationl2
- The second locationmask
- 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 newDexterityDisplay
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 locationl2
- The second locationmask
- A mask to use, or null for no maskl1_scale_offset
- The offset added to the minimum of the coordinatesl2_scale_offset
- The offset added to the maximum of the coordinates- Returns:
- A new DexterityDisplay representing the selection made by the two locations.
-