Class Hologram
java.lang.Object
net.minestom.server.entity.hologram.Hologram
- All Implemented Interfaces:
Viewable
public class Hologram extends java.lang.Object implements Viewable
Represents an invisible armor stand showing a
ColoredText
.-
Constructor Summary
Constructors Constructor Description Hologram(Instance instance, Position spawnPosition, ColoredText text)
Hologram(Instance instance, Position spawnPosition, ColoredText text, boolean autoViewable)
-
Method Summary
Modifier and Type Method Description boolean
addViewer(Player player)
Adds a viewer.net.minestom.server.entity.hologram.Hologram.HologramEntity
getEntity()
Gets the hologram entity (armor stand).Position
getPosition()
Gets the position of the hologram.ColoredText
getText()
Gets the hologram text.java.util.Set<Player>
getViewers()
Gets all the viewers of this viewable element.boolean
isRemoved()
Checks if the hologram is still present.void
remove()
Removes the hologram.boolean
removeViewer(Player player)
Removes a viewer.void
setPosition(Position position)
Changes the position of the hologram.void
setText(ColoredText text)
Changes the hologram text.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minestom.server.Viewable
isViewer, sendPacketsToViewers, sendPacketToViewers, sendPacketToViewersAndSelf
-
Constructor Details
-
Method Details
-
getPosition
Gets the position of the hologram.- Returns:
- the hologram's position
-
setPosition
Changes the position of the hologram.- Parameters:
position
- the new hologram's position
-
getText
Gets the hologram text.- Returns:
- the hologram text
-
setText
Changes the hologram text.- Parameters:
text
- the new hologram text
-
remove
public void remove()Removes the hologram. -
isRemoved
public boolean isRemoved()Checks if the hologram is still present.- Returns:
- true if the hologram is present, false otherwise
-
getEntity
public net.minestom.server.entity.hologram.Hologram.HologramEntity getEntity()Gets the hologram entity (armor stand).- Returns:
- the hologram entity
-
addViewer
Description copied from interface:Viewable
Adds a viewer. -
removeViewer
Description copied from interface:Viewable
Removes a viewer.- Specified by:
removeViewer
in interfaceViewable
- Parameters:
player
- the viewer to remove- Returns:
- true if the player has been removed, false otherwise (could be because he was not a viewer)
-
getViewers
Description copied from interface:Viewable
Gets all the viewers of this viewable element.- Specified by:
getViewers
in interfaceViewable
- Returns:
- A Set containing all the element's viewers
-