Class Hologram
java.lang.Object
net.minestom.server.entity.hologram.Hologram
- All Implemented Interfaces:
Viewable
Represents an invisible armor stand showing a
Component
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a viewer.Gets the hologram entity (armor stand).Gets the position of the hologram.getText()
Gets the hologram text.Gets all the viewers of this viewable element.boolean
Checks if the hologram is still present.void
remove()
Removes the hologram.boolean
removeViewer
(@NotNull Player player) Removes a viewer.void
setPosition
(Pos position) Changes the position of the hologram.void
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
getViewersAsAudience, getViewersAsAudiences, isViewer, sendPacketsToViewers, sendPacketsToViewers, sendPacketToViewers, sendPacketToViewersAndSelf
-
Constructor Details
-
Hologram
Constructs a newHologram
with the given parameters.- Parameters:
instance
- The instance where the hologram should be spawned.spawnPosition
- The spawn position of this hologram.text
- The text of this hologram.
-
Hologram
Constructs a newHologram
with the given parameters.- Parameters:
instance
- The instance where the hologram should be spawned.spawnPosition
- The spawn position of this hologram.text
- The text of this hologram.autoViewable
-true
if the hologram should be visible automatically, otherwisefalse
.
-
Hologram
public Hologram(Instance instance, Pos spawnPosition, Component text, boolean autoViewable, boolean marker) Constructs a newHologram
with the given parameters.- Parameters:
instance
- The instance where the hologram should be spawned.spawnPosition
- The spawn position of this hologram.text
- The text of this hologram.autoViewable
-true
if the hologram should be visible automatically, otherwisefalse
.
-
-
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
Gets the hologram entity (armor stand).- Returns:
- the hologram entity
-
addViewer
Adds a viewer. -
removeViewer
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
Gets all the viewers of this viewable element.- Specified by:
getViewers
in interfaceViewable
- Returns:
- A Set containing all the element's viewers
-