Class InteractionBox

java.lang.Object
com.maximde.hologramlib.hologram.InteractionBox

@Experimental public class InteractionBox extends Object
  • 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

      protected final String id
    • entityID

      protected int entityID
    • renderMode

      protected final RenderMode 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

      protected TaskHandle task
    • entity

      protected me.tofaa.entitylib.wrapper.WrapperEntity entity
    • attachedEntityId

      @Nullable protected Integer attachedEntityId
  • Constructor Details

  • 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

      public InteractionBox 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

      protected void validateId(String id)
    • kill

      @Deprecated public void kill()
      Deprecated.
      THIS METHOD WILL BE MADE 'private' SOON! Use HologramManager#remove(HologramInteraction) instead!
    • teleport

      public InteractionBox teleport(org.bukkit.Location newLocation)
    • 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

      public Set<Integer> getPassengers()
    • setUpdateTaskPeriod

      public InteractionBox setUpdateTaskPeriod(long updateTaskPeriod)
    • setMaxPlayerRenderDistanceSquared

      public InteractionBox setMaxPlayerRenderDistanceSquared(double maxPlayerRenderDistanceSquared)
    • setWidth

      public InteractionBox setWidth(float width)
    • setHeight

      public InteractionBox setHeight(float height)
    • setSize

      public InteractionBox setSize(Vector3F size)
    • setSize

      public InteractionBox setSize(float width, float height)
    • setResponsive

      public InteractionBox setResponsive(boolean responsive)
    • addViewer

      public InteractionBox addViewer(org.bukkit.entity.Player player)
    • removeViewer

      public InteractionBox removeViewer(org.bukkit.entity.Player player)
    • getViewerUUIDs

      public Set<UUID> getViewerUUIDs()
    • getViewers

      public List<org.bukkit.entity.Player> getViewers()
    • addAllViewers

      public InteractionBox addAllViewers(List<org.bukkit.entity.Player> viewerList)
    • removeAllViewers

      public InteractionBox removeAllViewers()
    • triggerInteraction

      public void triggerInteraction(org.bukkit.entity.Player player)
    • copy

      public InteractionBox 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

      public InteractionBox copy(String id)
      Creates a copy of this interaction with a new ID.
      Returns:
      A new HologramInteraction instance with copied properties
    • getSize

      public Vector3F getSize()
      Gets the size as a Vector3F (width, height, 0).