Package me.c7dev.dexterity.displays
Class DexterityDisplay
java.lang.Object
me.c7dev.dexterity.displays.DexterityDisplay
Defines a selection of
DexBlock
, possibly with a saved display label or sub-displays-
Constructor Summary
ConstructorDescriptionDexterityDisplay
(me.c7dev.dexterity.Dexterity plugin) Initializes an empty selection.DexterityDisplay
(me.c7dev.dexterity.Dexterity plugin, org.bukkit.Location center, org.bukkit.util.Vector scale) Initializes a selectionDexterityDisplay
(me.c7dev.dexterity.Dexterity plugin, org.bukkit.Location center, org.bukkit.util.Vector scale, String label) Initializes a new saved display with a unique label -
Method Summary
Modifier and TypeMethodDescriptionvoid
Registers a new animation type, as long as no animation type was already registered to this displayvoid
Adds a DexBlock to the selection.void
Adds a command to run when display is clickedvoid
void
align()
Teleport the selection so that its corner aligns with the nearest blockboolean
Checks whether it is appropriate to merge this display with another to form one displayvoid
consolidate
(Mask m) Consolidate along all axes to reduce the number of entities where possible without altering the selection's shapevoid
consolidate
(Mask m, BlockTransaction t) Consolidate along all axes to reduce the number of entities where possible without altering the selection's shapeboolean
Determines if passed in display is this or any descendant display nodeboolean
getAnimation
(Class<?> clazz) Retrieves a registered animation type if it existsint
DexBlock[]
Retrieves a list ofDexBlock
that can be iterated overint
org.bukkit.Location
Retrieves the center of the displayint
Retrieves the size of the command listRetrieves a list of commands to run when display is clickedRetrieve the UUID of the offline player who has this display in editing lockint
Gets the total count of nodes in the sub-display tree, including this nodegetLabel()
Retrieves the label if one is setRetrieves the parent display if this is a child displaydouble
getPitch()
me.c7dev.dexterity.Dexterity
Gets the instance of the plugindouble
getRoll()
Retrieves the root node of the sub-display treeGets the rotation manager if one is already createdgetRotationManager
(boolean create_new) Gets or creates a rotation managerorg.bukkit.util.Vector
getScale()
Retrieves the vector representing the overall scale of the displayint
org.bukkit.World
getWorld()
double
getYaw()
boolean
hardMerge
(DexterityDisplay subdisplay) Merges the DexBlocks in the display into this displayboolean
Checks whether there are running animations on this displayboolean
isSaved()
Checks if selection is a saved display or notboolean
Checks whether the rotation is simple enough to not involve pitch or rollmerge
(DexterityDisplay newparent, String new_group) Make this display become a child node of either a new display saved as new_group, or a child display of newparentvoid
Recalculates the average block display location and determines the overall selection's scalevoid
remove()
Delete this display and sub-displays from the worldvoid
remove
(boolean restore) Delete this display and sub-displays from the worldvoid
Unregisters an animation from displayvoid
removeBlock
(DexBlock db) Removes a DexBlock to the selection.void
Removes a command from being run when display is clickedvoid
static DexterityDisplay
Retrieves the root node of the sub-display tree of a displayorg.joml.Quaterniond
rotate
(float yaw_deg, float pitch_deg, float roll_deg) Rotate the display along the yaw, pitch, and roll directionsorg.joml.Quaterniond
rotate
(RotationPlan plan) Rotate the selectionvoid
scale
(double s) Scale by a multipliervoid
scale
(org.bukkit.util.Vector v) Skew by a multiplier along x, y, and z, respectivelyvoid
setBaseRotation
(float yaw, float pitch, float roll) Reset the direction axes to the specified yaw, pitch, and roll in degreesvoid
Overrides the blocks in this displayvoid
setCenter
(org.bukkit.Location loc) Sets the center of the displayvoid
Saves the display with the ascending default label ('display-#')void
Lock this display so that it cannot be selected by any other playervoid
setGlow
(org.bukkit.Color c, boolean propegate) Sets the glow color of the blocks in this displayboolean
Saves the selection and turns it into a display by giving it a labelvoid
Sets the parent display without affecting any child displaysorg.joml.Quaterniond
setRotation
(float yaw_deg, float pitch_deg, float roll_deg) Reset the rotation for yaw, pitch, and roll directionsvoid
setScale
(double s) Set the scalevoid
setScale
(org.bukkit.util.Vector s) Set the skew for x, y, and z, respectivelyvoid
Re-sorts the blocks list in the standard y, x, z ordervoid
Starts all registered animation types for this displayvoid
stopAnimations
(boolean force) Stops or kills all registered animations for this displayvoid
teleport
(org.bukkit.Location loc) Moves the display or transfers it to another worldvoid
teleport
(org.bukkit.util.Vector diff) Moves the display by an offsetvoid
unmerge()
Remove this display from its parent nodevoid
Unsaves the display and turns it into a regular selection
-
Constructor Details
-
DexterityDisplay
public DexterityDisplay(me.c7dev.dexterity.Dexterity plugin) Initializes an empty selection.- Parameters:
plugin
-
-
DexterityDisplay
public DexterityDisplay(me.c7dev.dexterity.Dexterity plugin, org.bukkit.Location center, org.bukkit.util.Vector scale) Initializes a selection- Parameters:
plugin
-center
-scale
- Vector with the regular block size being [1, 1, 1]
-
DexterityDisplay
public DexterityDisplay(me.c7dev.dexterity.Dexterity plugin, org.bukkit.Location center, org.bukkit.util.Vector scale, String label) Initializes a new saved display with a unique label- Parameters:
plugin
-center
-scale
- Vector with the regular block size being [1, 1, 1]label
-
-
-
Method Details
-
getUniqueId
-
equals
-
getLabel
Retrieves the label if one is set- Returns:
- Unmodifiable label string if selection is saved, otherwise null
-
getYaw
public double getYaw() -
getPitch
public double getPitch() -
getRoll
public double getRoll() -
recalculateCenter
public void recalculateCenter()Recalculates the average block display location and determines the overall selection's scale -
setDefaultLabel
public void setDefaultLabel()Saves the display with the ascending default label ('display-#') -
setLabel
Saves the selection and turns it into a display by giving it a label- Parameters:
s
- Unused label to save the display, or null to unsave it.- Returns:
- true if label is unique and the display is saved successfully
- See Also:
-
isSaved
public boolean isSaved()Checks if selection is a saved display or not- Returns:
- true if the display has a label, otherwise it is only a selection
-
unregister
public void unregister()Unsaves the display and turns it into a regular selection -
getBlocks
Retrieves a list ofDexBlock
that can be iterated over- Returns:
- Unmodifiable array of DexBlocks
- See Also:
-
getBlocksCount
public int getBlocksCount()- Returns:
- The integer number of DexBlocks within the selection
-
addBlock
Adds a DexBlock to the selection. If the DexBlock is not previously registered to a saved display, it will be registered to this- Parameters:
db
-- See Also:
-
removeBlock
Removes a DexBlock to the selection. The DexBlock must be killed or registered to another display.- Parameters:
db
-- See Also:
-
getAnimationsCount
public int getAnimationsCount()- Returns:
- The integer number of animations registered, active or not.
- See Also:
-
addAnimation
Registers a new animation type, as long as no animation type was already registered to this display- Parameters:
a
-- See Also:
-
removeAnimation
Unregisters an animation from display- Parameters:
a
-- See Also:
-
getAnimation
Retrieves a registered animation type if it exists- Parameters:
clazz
-- Returns:
- null if no animation of this type has been registered
- See Also:
-
getCommands
Retrieves a list of commands to run when display is clicked- Returns:
- Unmodifiable array of InteractionCommand cmd data
-
getCommandCount
public int getCommandCount()Retrieves the size of the command list- Returns:
- size of array
-
addCommand
Adds a command to run when display is clicked- Parameters:
cmd
-
-
removeCommand
Removes a command from being run when display is clicked- Parameters:
cmd
-
-
getScale
public org.bukkit.util.Vector getScale()Retrieves the vector representing the overall scale of the display- Returns:
-
setBlocks
Overrides the blocks in this display- Parameters:
entities
- A list of unique DexBlocksrecalc_center
- Recalculates the center point and scale if true- See Also:
-
getSubdisplays
- Returns:
- Unmodifiable array of sub-displays registered to this
-
getSubdisplayCount
public int getSubdisplayCount() -
addSubdisplay
-
removeSubdisplay
-
getParent
Retrieves the parent display if this is a child display- Returns:
- The parent display if defined
-
setParent
Sets the parent display without affecting any child displays- Parameters:
p
- parent display
-
getRootDisplay
Retrieves the root node of the sub-display tree- Returns:
- the root display node
-
rootDisplay
Retrieves the root node of the sub-display tree of a display- Parameters:
d
-- Returns:
- the root display node
-
containsSubdisplay
Determines if passed in display is this or any descendant display node- Parameters:
d
-- Returns:
- true if display passed in is a child or descendant of this
-
canHardMerge
public boolean canHardMerge()Checks whether it is appropriate to merge this display with another to form one display- Returns:
- true if can hard-merge
-
hasStartedAnimations
public boolean hasStartedAnimations()Checks whether there are running animations on this display- Returns:
- true if there are animations running
-
isYawOnly
public boolean isYawOnly()Checks whether the rotation is simple enough to not involve pitch or roll- Returns:
- true if only yaw is involved
-
hardMerge
Merges the DexBlocks in the display into this display- Parameters:
subdisplay
- The display that will be unregistered and whose blocks will be merged- Returns:
- true if operation is successful
-
merge
Make this display become a child node of either a new display saved as new_group, or a child display of newparent- Parameters:
newparent
- The display that will either be a brother node or parent node depending on if a new parent display is creatednew_group
- Label of the new parent display, or null for no new parent display- Returns:
- The parent display after the merge operation
-
getEditingLock
Retrieve the UUID of the offline player who has this display in editing lock- Returns:
- UUID of the offline player if in editing lock, otherwise null
-
setEditingLock
Lock this display so that it cannot be selected by any other player- Parameters:
u
- The UUID of the player who has this display locked to them
-
unmerge
public void unmerge()Remove this display from its parent node -
remove
public void remove(boolean restore) Delete this display and sub-displays from the world- Parameters:
restore
- true if the DexBlocks are to be deconverted into regular blocks
-
remove
public void remove()Delete this display and sub-displays from the world -
getGroupSize
public int getGroupSize()Gets the total count of nodes in the sub-display tree, including this node- Returns:
-
getPlugin
public me.c7dev.dexterity.Dexterity getPlugin()Gets the instance of the plugin- Returns:
-
getCenter
public org.bukkit.Location getCenter()Retrieves the center of the display- Returns:
-
getWorld
public org.bukkit.World getWorld() -
setCenter
public void setCenter(org.bukkit.Location loc) Sets the center of the display- Parameters:
loc
-
-
startAnimations
public void startAnimations()Starts all registered animation types for this display -
stopAnimations
public void stopAnimations(boolean force) Stops or kills all registered animations for this display- Parameters:
force
- true if the animations should be killed instead of allowed to stop
-
teleport
public void teleport(org.bukkit.Location loc) Moves the display or transfers it to another world- Parameters:
loc
-
-
teleport
public void teleport(org.bukkit.util.Vector diff) Moves the display by an offset- Parameters:
diff
-
-
setGlow
public void setGlow(org.bukkit.Color c, boolean propegate) Sets the glow color of the blocks in this display- Parameters:
c
- The color of the glowpropegate
- true if descendant displays should receive this update
-
scale
public void scale(double s) Scale by a multiplier- Parameters:
s
-
-
setScale
public void setScale(double s) Set the scale- Parameters:
s
- Representing x, y, and z scale
-
setScale
public void setScale(org.bukkit.util.Vector s) Set the skew for x, y, and z, respectively- Parameters:
s
-
-
scale
public void scale(org.bukkit.util.Vector v) Skew by a multiplier along x, y, and z, respectively- Parameters:
v
-
-
align
public void align()Teleport the selection so that its corner aligns with the nearest block -
rotate
public org.joml.Quaterniond rotate(float yaw_deg, float pitch_deg, float roll_deg) Rotate the display along the yaw, pitch, and roll directions- Parameters:
yaw_deg
-pitch_deg
-roll_deg
-- Returns:
- The quaternion representing the rotation
-
setRotation
public org.joml.Quaterniond setRotation(float yaw_deg, float pitch_deg, float roll_deg) Reset the rotation for yaw, pitch, and roll directions- Parameters:
yaw_deg
-pitch_deg
-roll_deg
-- Returns:
- The quaternion representing the rotation
-
setBaseRotation
public void setBaseRotation(float yaw, float pitch, float roll) Reset the direction axes to the specified yaw, pitch, and roll in degrees- Parameters:
yaw
-pitch
-roll
-
-
getRotationManager
Gets the rotation manager if one is already created- Returns:
-
getRotationManager
Gets or creates a rotation manager- Parameters:
create_new
-- Returns:
- the existing or new rotation manager
-
rotate
Rotate the selection- Parameters:
plan
-- Returns:
- The quaternion representing the rotation
-
sortBlocks
public void sortBlocks()Re-sorts the blocks list in the standard y, x, z order -
consolidate
Consolidate along all axes to reduce the number of entities where possible without altering the selection's shape- Parameters:
m
- Mask to use, or null for no mask
-
consolidate
Consolidate along all axes to reduce the number of entities where possible without altering the selection's shape- Parameters:
m
- Mask to use, or null for no maskt
- The transaction to set blocks to or null
-