Klasse Hologram

java.lang.Object
de.oliver.fancyholograms.api.hologram.Hologram

public abstract class Hologram extends Object
Abstract base class for creating, updating, and managing holograms.

This class provides the basic functionality needed to work with holograms across multiple versions of Minecraft. To create a hologram specific to a version of Minecraft, extend this class and implement the abstract methods.

Note that the specific way holograms are created, updated, and deleted will vary depending on the Minecraft version.

A Hologram object includes data about the hologram and maintains a set of players to whom the hologram is shown.

  • Feldübersicht

    Felder
    Modifizierer und Typ
    Feld
    Beschreibung
    protected final @NotNull HologramData
     
    static final int
     
    protected static final int
     
    static final org.bukkit.Color
     
    protected final @NotNull Set<UUID>
    Set of UUIDs of players to whom the hologram is currently shown.
  • Konstruktorübersicht

    Konstruktoren
    Modifizierer
    Konstruktor
    Beschreibung
    protected
    Hologram(@NotNull HologramData data)
     
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    protected abstract void
     
    final void
    Create the hologram entity.
    protected abstract void
     
    final void
    Deletes the hologram entity.
    final boolean
    equals(@Nullable Object o)
     
    final void
    forceHideHologram(org.bukkit.entity.Player player)
    Forcefully hides the hologram from a player.
    final void
    forceShowHologram(org.bukkit.entity.Player player)
    Forcefully shows the hologram to a player.
    final void
    Forcefully updates and refreshes hologram for players.
    void
    forceUpdateShownStateFor(org.bukkit.entity.Player player)
    Checks and forcefully updates the shown state for a player.
    final @NotNull HologramData
     
    abstract @Nullable org.bukkit.entity.Display
    Returns the Display entity of this Hologram object.
    @NotNull String
     
    final net.kyori.adventure.text.Component
    getShownText(@Nullable org.bukkit.entity.Player player)
    Gets the text shown in the hologram.
    final @NotNull @UnmodifiableView Set<UUID>
     
    final int
     
    protected abstract boolean
    hide(@NotNull org.bukkit.entity.Player player)
     
    final void
    hideHologram(Collection<? extends org.bukkit.entity.Player> players)
    Hides the hologram from a collection of players.
    final void
    hideHologram(org.bukkit.entity.Player player)
    Hides the hologram from a player.
    final boolean
    isViewer(@NotNull UUID player)
     
    final boolean
    isViewer(@NotNull org.bukkit.entity.Player player)
     
    boolean
    isWithinVisibilityDistance(@NotNull org.bukkit.entity.Player player)
     
    boolean
    meetsVisibilityConditions(@NotNull org.bukkit.entity.Player player)
     
    final void
    Queues hologram to update and refresh for players Use forceUpdate() if this hologram is not registered to the HologramManager.
    protected abstract void
    refresh(@NotNull org.bukkit.entity.Player player)
     
    void
    Refreshes the hologram for the players currently viewing it.
    void
    Refreshes the hologram for players currently viewing it in the same world as the hologram.
    final void
    refreshHologram(@NotNull Collection<? extends org.bukkit.entity.Player> players)
    Refreshes the hologram's data for a collection of players.
    final void
    refreshHologram(@NotNull org.bukkit.entity.Player player)
    Refreshes the hologram's data for a player.
    protected boolean
    shouldShowTo(@NotNull org.bukkit.entity.Player player)
     
    protected abstract boolean
    show(@NotNull org.bukkit.entity.Player player)
     
    final void
    showHologram(Collection<? extends org.bukkit.entity.Player> players)
    Shows the hologram to a collection of players.
    final void
    showHologram(org.bukkit.entity.Player player)
    Shows the hologram to a player.
    protected abstract void
     
    final void
    Veraltet, zur Entfernung: Dieses API-Element wird in einer zukünftigen Version entfernt.
    in favour of queueUpdate()
    void
    updateShownStateFor(org.bukkit.entity.Player player)
    Checks and updates the shown state for a player.

    Von Klasse geerbte Methoden java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Felddetails

    • LINE_WIDTH

      public static final int LINE_WIDTH
      Siehe auch:
    • TRANSPARENT

      public static final org.bukkit.Color TRANSPARENT
    • MINIMUM_PROTOCOL_VERSION

      protected static final int MINIMUM_PROTOCOL_VERSION
      Siehe auch:
    • data

      @NotNull protected final @NotNull HologramData data
    • viewers

      @NotNull protected final @NotNull Set<UUID> viewers
      Set of UUIDs of players to whom the hologram is currently shown.
  • Konstruktordetails

    • Hologram

      protected Hologram(@NotNull @NotNull HologramData data)
  • Methodendetails

    • getName

      @NotNull public @NotNull String getName()
    • getData

      @NotNull public final @NotNull HologramData getData()
    • getDisplayEntity

      @Nullable public abstract @Nullable org.bukkit.entity.Display getDisplayEntity()
      Returns the Display entity of this Hologram object. The entity is not registered in the world or server. Only use this method if you know what you're doing.
      Gibt zurück:
      the Display entity of this Hologram object
    • create

      protected abstract void create()
    • delete

      protected abstract void delete()
    • update

      protected abstract void update()
    • show

      protected abstract boolean show(@NotNull @NotNull org.bukkit.entity.Player player)
    • hide

      protected abstract boolean hide(@NotNull @NotNull org.bukkit.entity.Player player)
    • refresh

      protected abstract void refresh(@NotNull @NotNull org.bukkit.entity.Player player)
    • createHologram

      public final void createHologram()
      Create the hologram entity. Only run this if creating custom Hologram implementations as this is run in HologramManager.create(HologramData).
    • deleteHologram

      public final void deleteHologram()
      Deletes the hologram entity.
    • showHologram

      public final void showHologram(Collection<? extends org.bukkit.entity.Player> players)
      Shows the hologram to a collection of players. Use forceShowHologram(Player) if this hologram is not registered to the HologramManager.
      Parameter:
      players - The players to show the hologram to
    • showHologram

      public final void showHologram(org.bukkit.entity.Player player)
      Shows the hologram to a player. Use forceShowHologram(Player) if this hologram is not registered to the HologramManager.
      Parameter:
      player - The player to show the hologram to
    • forceShowHologram

      public final void forceShowHologram(org.bukkit.entity.Player player)
      Forcefully shows the hologram to a player.
      Parameter:
      player - The player to show the hologram to
    • hideHologram

      public final void hideHologram(Collection<? extends org.bukkit.entity.Player> players)
      Hides the hologram from a collection of players. Use forceHideHologram(Player) if this hologram is not registered to the HologramManager.
      Parameter:
      players - The players to hide the hologram from
    • hideHologram

      public final void hideHologram(org.bukkit.entity.Player player)
      Hides the hologram from a player. Use forceHideHologram(Player) if this hologram is not registered to the HologramManager.
      Parameter:
      player - The player to hide the hologram from
    • forceHideHologram

      public final void forceHideHologram(org.bukkit.entity.Player player)
      Forcefully hides the hologram from a player.
      Parameter:
      player - The player to show the hologram to
    • updateHologram

      @Deprecated(forRemoval=true) public final void updateHologram()
      Veraltet, zur Entfernung: Dieses API-Element wird in einer zukünftigen Version entfernt.
      in favour of queueUpdate()
      Queues hologram to update and refresh for players.
    • queueUpdate

      public final void queueUpdate()
      Queues hologram to update and refresh for players Use forceUpdate() if this hologram is not registered to the HologramManager.
    • forceUpdate

      public final void forceUpdate()
      Forcefully updates and refreshes hologram for players.
    • refreshForViewers

      public void refreshForViewers()
      Refreshes the hologram for the players currently viewing it.
    • refreshForViewersInWorld

      public void refreshForViewersInWorld()
      Refreshes the hologram for players currently viewing it in the same world as the hologram.
    • refreshHologram

      public final void refreshHologram(@NotNull @NotNull org.bukkit.entity.Player player)
      Refreshes the hologram's data for a player.
      Parameter:
      player - the player to refresh for
    • refreshHologram

      public final void refreshHologram(@NotNull @NotNull Collection<? extends org.bukkit.entity.Player> players)
      Refreshes the hologram's data for a collection of players.
      Parameter:
      players - the collection of players to refresh for
    • getViewers

      @NotNull public final @NotNull @UnmodifiableView Set<UUID> getViewers()
      Gibt zurück:
      an unmodifiable set of current viewers
    • isViewer

      public final boolean isViewer(@NotNull @NotNull org.bukkit.entity.Player player)
      Parameter:
      player - the player to check for
      Gibt zurück:
      whether the player is currently viewing the hologram
    • isViewer

      public final boolean isViewer(@NotNull @NotNull UUID player)
      Parameter:
      player - the uuid of the player to check for
      Gibt zurück:
      whether the player is currently viewing the hologram
    • shouldShowTo

      protected boolean shouldShowTo(@NotNull @NotNull org.bukkit.entity.Player player)
    • meetsVisibilityConditions

      public boolean meetsVisibilityConditions(@NotNull @NotNull org.bukkit.entity.Player player)
    • isWithinVisibilityDistance

      public boolean isWithinVisibilityDistance(@NotNull @NotNull org.bukkit.entity.Player player)
    • updateShownStateFor

      public void updateShownStateFor(org.bukkit.entity.Player player)
      Checks and updates the shown state for a player. If the hologram is shown and should not be, it hides it. If the hologram is not shown and should be, it shows it. Use forceUpdateShownStateFor(Player) if this hologram is not registered to the HologramManager.
      Parameter:
      player - the player to check and update the shown state for
    • forceUpdateShownStateFor

      public void forceUpdateShownStateFor(org.bukkit.entity.Player player)
      Checks and forcefully updates the shown state for a player. If the hologram is shown and should not be, it hides it. If the hologram is not shown and should be, it shows it.
      Parameter:
      player - the player to check and update the shown state for
    • getShownText

      public final net.kyori.adventure.text.Component getShownText(@Nullable @Nullable org.bukkit.entity.Player player)
      Gets the text shown in the hologram. If a player is specified, placeholders in the text are replaced with their corresponding values for the player.
      Parameter:
      player - the player to get the placeholders for, or null if no placeholders should be replaced
      Gibt zurück:
      the text shown in the hologram
    • equals

      public final boolean equals(@Nullable @Nullable Object o)
      Setzt außer Kraft:
      equals in Klasse Object
    • hashCode

      public final int hashCode()
      Setzt außer Kraft:
      hashCode in Klasse Object