Package com.maximde.hologramlib.hologram
Class InteractionBox
java.lang.Object
com.maximde.hologramlib.hologram.InteractionBox
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static interface
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Integer
protected boolean
protected me.tofaa.entitylib.wrapper.WrapperEntity
protected int
protected final com.github.retrooper.packetevents.protocol.entity.type.EntityType
protected float
protected final String
protected org.bukkit.Location
protected double
protected final RenderMode
The render mode determines which players can see the interaction: - NEARBY: Only players within viewing distance - ALL: All players on the server - VIEWER_LIST: Only specific players added as viewers - NONE: Interaction is not visible to any playersprotected boolean
protected TaskHandle
protected long
protected float
-
Constructor Summary
ConstructorsConstructorDescriptionInteractionBox
(String id, InteractionBox.OnInteract onInteract) InteractionBox
(String id, RenderMode renderMode, InteractionBox.OnInteract onInteract) -
Method Summary
Modifier and TypeMethodDescriptionaddAllViewers
(List<org.bukkit.entity.Player> viewerList) static int[]
addElement
(int[] array, int element) Adds an element to the array if it is not already present.void
addPassenger
(int... entityIDs) Attaches entities to this interaction.void
addToViewerBlacklist
(org.bukkit.entity.Player player) addViewer
(org.bukkit.entity.Player player) protected me.tofaa.entitylib.meta.EntityMeta
void
attach
(int entityId) Attaches this interaction to another entity, making it ride the target entity.void
attachToPlayer
(org.bukkit.entity.Player player) Attaches this interaction to a player.copy()
Creates a copy of this interaction with a new ID.Creates a copy of this interaction with a new ID.void
detach()
Detaches the interaction from its attached entity, if any.getSize()
Gets the size as a Vector3F (width, height, 0).List<org.bukkit.entity.Player>
void
hide
(org.bukkit.entity.Player player) void
kill()
Deprecated.static int[]
removeElement
(int[] array, int element) Removes all occurrences of the specified element from the given array.void
removeFromViewerBlacklist
(org.bukkit.entity.Player player) removeViewer
(org.bukkit.entity.Player player) protected void
sendPacket
(com.github.retrooper.packetevents.wrapper.PacketWrapper<?> packet, List<org.bukkit.entity.Player> players) setHeight
(float height) setMaxPlayerRenderDistanceSquared
(double maxPlayerRenderDistanceSquared) setResponsive
(boolean responsive) setSize
(float width, float height) setUpdateTaskPeriod
(long updateTaskPeriod) setWidth
(float width) void
show
(org.bukkit.entity.Player player) teleport
(org.bukkit.Location newLocation) void
triggerInteraction
(org.bukkit.entity.Player player) update()
Updates the set properties for the entity (shows them to the players).protected void
validateId
(String id)
-
Field Details
-
location
protected org.bukkit.Location location -
dead
protected boolean dead -
updateTaskPeriod
protected long updateTaskPeriod -
maxPlayerRenderDistanceSquared
protected double maxPlayerRenderDistanceSquared -
width
protected float width -
height
protected float height -
responsive
protected boolean responsive -
id
-
entityID
protected int entityID -
renderMode
The render mode determines which players can see the interaction: - NEARBY: Only players within viewing distance - ALL: All players on the server - VIEWER_LIST: Only specific players added as viewers - NONE: Interaction is not visible to any players -
entityType
protected final com.github.retrooper.packetevents.protocol.entity.type.EntityType entityType -
task
-
entity
protected me.tofaa.entitylib.wrapper.WrapperEntity entity -
attachedEntityId
-
-
Constructor Details
-
InteractionBox
-
InteractionBox
-
-
Method Details
-
show
public void show(org.bukkit.entity.Player player) -
hide
public void hide(org.bukkit.entity.Player player) -
addToViewerBlacklist
public void addToViewerBlacklist(org.bukkit.entity.Player player) -
removeFromViewerBlacklist
public void removeFromViewerBlacklist(org.bukkit.entity.Player player) -
update
Updates the set properties for the entity (shows them to the players). Should be called after making any changes to the interaction object. -
validateId
-
kill
Deprecated.THIS METHOD WILL BE MADE 'private' SOON! Use HologramManager#remove(HologramInteraction) instead! -
teleport
-
applyMeta
protected me.tofaa.entitylib.meta.EntityMeta applyMeta() -
sendPacket
protected void sendPacket(com.github.retrooper.packetevents.wrapper.PacketWrapper<?> packet, List<org.bukkit.entity.Player> players) -
attachToPlayer
public void attachToPlayer(org.bukkit.entity.Player player) Attaches this interaction to a player.- Parameters:
player
- The player to attach the interaction to
-
attach
@Experimental public void attach(int entityId) Attaches this interaction to another entity, making it ride the target entity. Warning: Keep in mind that the interaction's location is not automatically updated when it is attached to another entity, so if the entity moves too far away from the interaction's location, the interaction may be unloaded. To work around this, you will need to teleport the interaction to the entity's location when the entity is moved far away from the interaction's original location.- Parameters:
entityId
- The entity id to attach the interaction to
-
detach
@Experimental public void detach()Detaches the interaction from its attached entity, if any. -
addElement
public static int[] addElement(int[] array, int element) Adds an element to the array if it is not already present. -
removeElement
public static int[] removeElement(int[] array, int element) Removes all occurrences of the specified element from the given array. -
addPassenger
public void addPassenger(int... entityIDs) Attaches entities to this interaction.- Parameters:
entityIDs
- The passengers
-
getPassengers
-
setUpdateTaskPeriod
-
setMaxPlayerRenderDistanceSquared
-
setWidth
-
setHeight
-
setSize
-
setSize
-
setResponsive
-
addViewer
-
removeViewer
-
getViewerUUIDs
-
getViewers
-
addAllViewers
-
removeAllViewers
-
triggerInteraction
public void triggerInteraction(org.bukkit.entity.Player player) -
copy
Creates a copy of this interaction with a new ID. The new ID will be the original ID with '_copy_' followed by a random number appended.- Returns:
- A new HologramInteraction instance with copied properties
-
copy
Creates a copy of this interaction with a new ID.- Returns:
- A new HologramInteraction instance with copied properties
-
getSize
Gets the size as a Vector3F (width, height, 0).
-