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
ConstructorsConstructorDescriptionDexterityDisplay(Dexterity plugin) Initializes an empty selection.DexterityDisplay(Dexterity plugin, org.bukkit.Location center, org.bukkit.util.Vector scale) Initializes a selectionDexterityDisplay(Dexterity plugin, org.bukkit.Location center, org.bukkit.util.Vector scale, String label) Initializes a new saved display with a unique labelDexterityDisplay(Dexterity plugin, org.bukkit.Location center, org.bukkit.util.Vector scale, String label, List<org.bukkit.OfflinePlayer> owners) Initializes a new saved display with a unique label -
Method Summary
Modifier and TypeMethodDescriptionvoidRegisters a new animation type, as long as no animation type was already registered to this displayvoidAdds a DexBlock to the selection.voidAdds a command to run when display is clickedvoidaddOwner(org.bukkit.OfflinePlayer p) Appends a player who can edit this displayvoidvoidalign()Teleport the selection so that its corner aligns with the nearest whole blockvoidalign(boolean toCenter) Teleport the selection so that its corner or center aligns with the nearest whole blockvoidalign(boolean toCenter, boolean x, boolean y, boolean z) Teleport the selection so that its corner or center aligns with the nearest whole block along a certain axis of movementbooleanChecks whether it is appropriate to merge this display with another to form one displayvoidconsolidate(int axis, Mask m) Deprecated.voidconsolidate(Mask m) Consolidate along all axes to reduce the number of entities where possible without altering the selection's shapevoidconsolidate(Mask m, BlockTransaction t) Consolidate along all axes to reduce the number of entities where possible without altering the selection's shapebooleanDetermines if passed in display is this or any descendant display nodevoidRemove the display but drop it as an item if an item has been definedbooleangetAnimation(Class<?> clazz) Retrieves a registered animation type if it existsintDexBlock[]Retrieves a list ofDexBlockthat can be iterated overintorg.bukkit.util.BoundingBoxorg.bukkit.LocationRetrieves the center of the displayintRetrieves the size of the command listRetrieves a list of commands to run when display is clickedorg.bukkit.inventory.ItemStackGets a copy of the item that will be dropped when the player breaks the displayRetrieve the UUID of the offline player who has this display in editing lockintGets the total count of nodes in the sub-display tree, including this nodegetLabel()Retrieves the label if one is setorg.bukkit.OfflinePlayer[]Returns an array of the player(s) that own this displayRetrieves the parent display if this is a child displaydoublegetPitch()Gets the instance of the plugindoublegetRoll()Retrieves the root node of the sub-display treeGets the rotation manager if one is already createdgetRotationManager(boolean createNew) Gets or creates a rotation managerorg.bukkit.util.VectorgetScale()Retrieves the vector representing the overall scale of the displayintorg.bukkit.WorldgetWorld()doublegetYaw()booleanhardMerge(DexterityDisplay subdisplay) Merges the DexBlocks in the display into this displaybooleanhasOwner(org.bukkit.entity.Player p) Returns true if the player is one of the owners OR if the player has permission dexterity.select.unownedbooleanChecks whether there are running animations on this displaybooleanisListed()Checks if display is listed on normal listbooleanisSaved()Checks if selection is a saved display or notbooleanChecks whether the rotation is simple enough to not involve pitch or rollmerge(DexterityDisplay newParent, String newGroup) Make this display become a child node of either a new display saved as new_group, or a child display of newparentvoidRecalculates the average block display location and the overall selection's scale.voidrecalculateCenter(boolean rescale) Recalculates the average block display location and optionally recalculates the overall selection's scalevoidremove()Delete this display and sub-displays from the worldvoidremove(boolean restore) Delete this display and sub-displays from the worldvoidUnregisters an animation from displayvoidremoveBlock(DexBlock db) Removes a DexBlock to the selection.voidRemoves a command from being run when display is clickedvoidremoveOwner(org.bukkit.OfflinePlayer p) Removes a player from the owners listvoidvoidresetScale(org.bukkit.util.Vector v) Deprecated.static DexterityDisplayRetrieves the root node of the sub-display tree of a displayorg.joml.Quaterniondrotate(float yawDeg, float pitchDeg, float rollDeg) Rotate the display along the yaw, pitch, and roll directionsorg.joml.Quaterniondrotate(RotationPlan plan) Rotate the selectionvoidscale(double s) Scale by a multipliervoidscale(org.bukkit.util.Vector v) Skew by a multiplier along x, y, and z, respectivelyvoidsetBaseRotation(float yaw, float pitch, float roll) Reset the direction axes to the specified yaw, pitch, and roll in degreesvoidsetBaseRotation(org.bukkit.util.Vector x, org.bukkit.util.Vector y, org.bukkit.util.Vector z) Reset the direction axes to the specified x, y, and z orthonormal vectorsvoidOverrides the blocks in this displayvoidsetCenter(org.bukkit.Location loc) Sets the center of the displayvoidSaves the display with the ascending default label ('display-#')voidsetDropItem(org.bukkit.inventory.ItemStack item, String schemName) Sets the item that will be dropped if a player breaks the displayvoidLock this display so that it cannot be selected by any other playervoidsetGlow(org.bukkit.Color c, boolean propegate) Sets the glow color of the blocks in this displaybooleanSaves the selection and turns it into a display by giving it a labelvoidsetListed(boolean b) Set to false to hide display from /d list.voidSets the players that own this displayvoidSets the parent display without affecting any child displaysorg.joml.QuaterniondsetRotation(float yawDeg, float pitchDeg, float rollDeg) Reset the rotation for yaw, pitch, and roll directionsvoidsetScale(double s) Set the scalevoidsetScale(org.bukkit.util.Vector s) Set the skew for x, y, and z, respectivelyvoidsetZeroPitch(boolean b) Deprecated.voidRe-sorts the blocks list in the standard y, x, z ordervoidStarts all registered animation types for this displayvoidstopAnimations(boolean force) Stops or kills all registered animations for this displayvoidteleport(org.bukkit.Location loc) Moves the display or transfers it to another worldvoidteleport(org.bukkit.util.Vector diff) Moves the display by an offsetvoidunmerge()Remove this display from its parent nodevoidUnsaves the display and turns it into a regular selection
-
Constructor Details
-
DexterityDisplay
Initializes an empty selection.- Parameters:
plugin-
-
DexterityDisplay
Initializes a selection- Parameters:
plugin-center-scale- Vector with the regular block size being [1, 1, 1]
-
DexterityDisplay
public DexterityDisplay(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-
-
DexterityDisplay
public DexterityDisplay(Dexterity plugin, org.bukkit.Location center, org.bukkit.util.Vector scale, String label, List<org.bukkit.OfflinePlayer> owners) Initializes a new saved display with a unique label- Parameters:
plugin-center-scale- Vector with the regular block size being [1, 1, 1]label-owners-
-
-
Method Details
-
getUniqueId
-
equals
-
getLabel
Retrieves the label if one is set- Returns:
- Unmodifiable label string if selection is saved, otherwise null
-
setListed
public void setListed(boolean b) Set to false to hide display from /d list. All saved displays are listed by default- Parameters:
b-
-
isListed
public boolean isListed()Checks if display is listed on normal list- Returns:
- true if display will show on the saved display list (/d list), or false if display is only intended to be temporary.
-
getYaw
public double getYaw() -
getPitch
public double getPitch() -
getRoll
public double getRoll() -
getOwners
public org.bukkit.OfflinePlayer[] getOwners()Returns an array of the player(s) that own this display- Returns:
-
setOwners
Sets the players that own this display- Parameters:
newOwners-
-
hasOwner
public boolean hasOwner(org.bukkit.entity.Player p) Returns true if the player is one of the owners OR if the player has permission dexterity.select.unowned- Parameters:
p-- Returns:
-
addOwner
public void addOwner(org.bukkit.OfflinePlayer p) Appends a player who can edit this display- Parameters:
p-
-
removeOwner
public void removeOwner(org.bukkit.OfflinePlayer p) Removes a player from the owners list- Parameters:
p-
-
recalculateCenter
public void recalculateCenter()Recalculates the average block display location and the overall selection's scale. -
recalculateCenter
public void recalculateCenter(boolean rescale) Recalculates the average block display location and optionally recalculates the overall selection's scale- Parameters:
rescale- If false, does not change 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 ofDexBlockthat 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:
-
setDropItem
Sets the item that will be dropped if a player breaks the display- Parameters:
item-
-
getDropItemSchematicName
-
getDropItem
public org.bukkit.inventory.ItemStack getDropItem()Gets a copy of the item that will be dropped when the player breaks the display- Returns:
-
dropNaturally
public void dropNaturally()Remove the display but drop it as an item if an item has been defined -
setBlocks
Overrides the blocks in this display- Parameters:
entities- A list of unique DexBlocksrecalcCenter- 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
-
setZeroPitch
Deprecated. -
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 creatednewGroup- 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
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-- Throws:
DexterityException- if skewing a selection with more than 1 rotation orientation, as it is impossible to create parallelograms
-
resetScale
Deprecated. -
align
public void align()Teleport the selection so that its corner aligns with the nearest whole block -
align
public void align(boolean toCenter) Teleport the selection so that its corner or center aligns with the nearest whole block- Parameters:
toCenter- If true, aligns based on the display's center, otherwise by its corner.
-
align
public void align(boolean toCenter, boolean x, boolean y, boolean z) Teleport the selection so that its corner or center aligns with the nearest whole block along a certain axis of movement- Parameters:
toCenter- If true, aligns based on the display's center, otherwise by its corner.x- If x axis movement is allowedy- If y axis movement is allowedz- If z axis movement is allowed
-
rotate
public org.joml.Quaterniond rotate(float yawDeg, float pitchDeg, float rollDeg) Rotate the display along the yaw, pitch, and roll directions- Parameters:
yawDeg-pitchDeg-rollDeg-- Returns:
- The quaternion representing the rotation
-
setRotation
public org.joml.Quaterniond setRotation(float yawDeg, float pitchDeg, float rollDeg) Reset the rotation for yaw, pitch, and roll directions- Parameters:
yawDeg-pitchDeg-rollDeg-- 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-
-
setBaseRotation
public void setBaseRotation(org.bukkit.util.Vector x, org.bukkit.util.Vector y, org.bukkit.util.Vector z) Reset the direction axes to the specified x, y, and z orthonormal vectors- Parameters:
x-y-z-
-
getRotationManager
Gets the rotation manager if one is already created- Returns:
-
getRotationManager
Gets or creates a rotation manager- Parameters:
createNew-- Returns:
- the existing or new rotation manager
-
rotate
Rotate the selection- Parameters:
plan-- Returns:
- The quaternion representing the rotation
-
getBoundingBox
public org.bukkit.util.BoundingBox getBoundingBox() -
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
-
consolidate
Deprecated.
-