Interface HologramLines


public interface HologramLines
The editable lines of a hologram, following a top to bottom order (first line is top one, last line is the bottom one).
Since:
1
  • Method Summary

    Modifier and Type
    Method
    Description
    appendItem(@Nullable org.bukkit.inventory.ItemStack itemStack)
    Adds a new item line at the bottom.
    appendText(@Nullable String text)
    Adds a new text line at the bottom.
    void
    Removes all the lines.
    @NotNull HologramLine
    get(int index)
    Returns the line at the given index.
    double
    The total height in blocks occupied by the lines, including the gaps between them.
    insertItem(int beforeIndex, @NotNull org.bukkit.inventory.ItemStack itemStack)
    Inserts a new item line before the line at the given index, shifting all the lines below.
    insertText(int beforeIndex, @Nullable String text)
    Inserts a new text line before the line at the given index, shifting all the lines below.
    void
    remove(int index)
    Removes the line at the given index.
    boolean
    remove(@NotNull HologramLine line)
    Removes a line.
    int
    Returns the current amount of lines.
  • Method Details

    • appendText

      @NotNull @NotNull TextHologramLine appendText(@Nullable @Nullable String text)
      Adds a new text line at the bottom.
      Parameters:
      text - the content of the line, see TextHologramLine.setText(String)
      Returns:
      the created line
      Since:
      1
    • appendItem

      @NotNull @NotNull ItemHologramLine appendItem(@Nullable @Nullable org.bukkit.inventory.ItemStack itemStack)
      Adds a new item line at the bottom.
      Parameters:
      itemStack - the content of the line, see ItemHologramLine.setItemStack(ItemStack)
      Returns:
      the created line
      Since:
      1
    • insertText

      @NotNull @NotNull TextHologramLine insertText(int beforeIndex, @Nullable @Nullable String text)
      Inserts a new text line before the line at the given index, shifting all the lines below.
      Parameters:
      beforeIndex - the index before which the line should be inserted, 0 to insert on top
      text - the content of the line, see TextHologramLine.setText(String)
      Returns:
      the created line
      Throws:
      IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
      Since:
      1
    • insertItem

      @NotNull @NotNull ItemHologramLine insertItem(int beforeIndex, @NotNull @NotNull org.bukkit.inventory.ItemStack itemStack)
      Inserts a new item line before the line at the given index, shifting all the lines below.
      Parameters:
      beforeIndex - the index before which the line should be inserted, 0 to insert on top
      itemStack - the content of the line, see ItemHologramLine.setItemStack(ItemStack)
      Returns:
      the created line
      Throws:
      IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
      Since:
      1
    • get

      @NotNull @NotNull HologramLine get(int index)
      Returns the line at the given index.
      Parameters:
      index - the index of the line to retrieve
      Returns:
      the line at the given index
      Throws:
      IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
      Since:
      1
    • remove

      void remove(int index)
      Removes the line at the given index.
      Parameters:
      index - the index of the line to remove
      Throws:
      IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
      Since:
      1
    • remove

      boolean remove(@NotNull @NotNull HologramLine line)
      Removes a line.
      Parameters:
      line - the line to be removed
      Returns:
      if the line was found and removed
      Since:
      1
    • clear

      void clear()
      Removes all the lines.
      Since:
      1
    • size

      int size()
      Returns the current amount of lines.
      Returns:
      the current amount of lines
      Since:
      1
    • getHeight

      double getHeight()
      The total height in blocks occupied by the lines, including the gaps between them.
      Returns:
      the total height of the lines
      Since:
      1