VitalHologramService

class VitalHologramService(plugin: SpigotPlugin, vitalHologramRepository: VitalHologramRepository)

Global service to create and delete holograms. Every created hologram will be stored globally in VitalHologramRepository.

Constructors

Link copied to clipboard
constructor(plugin: SpigotPlugin, vitalHologramRepository: VitalHologramRepository)

Functions

Link copied to clipboard
fun createGlobalHologram(location: Location, vararg linesFunctions: Supplier<VitalHologram.Line>): VitalHologram

Creates a hologram at the given location which displays all given lines that is visible to all players on the server. The created hologram is stored in VitalHologramRepository.

Link copied to clipboard
fun createPlayerHologram(player: SpigotPlayer, location: Location, vararg linesFunctions: Function<SpigotPlayer, VitalHologram.Line>): VitalPlayerHologram

Creates a hologram at the given location which displays the given lines that is visible to only the passed player. The created hologram is stored in VitalHologramRepository.

Link copied to clipboard

Deletes the given hologram. The hologram will also be deleted from VitalHologramRepository.

fun deleteHologram(armorStandUniqueId: UUID, lineArmorStandUniqueIds: List<UUID>)

Deletes a hologram by the given armorStandUniqueId and lineArmorStandUniqueIds. The hologram will also be deleted from VitalHologramRepository.

Link copied to clipboard
fun hideHologram(player: SpigotPlayer, hologram: VitalHologram)

Hides the given hologram for the given player.

fun hideHologram(player: SpigotPlayer, armorStandUniqueId: UUID, lineArmorStandUniqueIds: List<UUID>)

Hides a hologram by the given armorStandUniqueId and lineArmorStandUniqueIds for the given player.

Link copied to clipboard

Hides all other known holograms that are registered in VitalHologramRepository and are not owned by the given player. Note that this function will only work correctly, if all holograms are loaded into VitalHologramRepository. If not, this function will fail to hide other holograms since Vital is not aware of their existence.

Link copied to clipboard
fun showHologram(player: SpigotPlayer, hologram: VitalHologram)

Shows the given hologram for the given player. If given hologram has been hidden using hideHologram before, this function will make it visible again.

fun showHologram(player: SpigotPlayer, armorStandUniqueId: UUID, lineArmorStandUniqueIds: List<UUID>)

Shows a hologram by the given armorStandUniqueId and lineArmorStandUniqueIds for the given player. If the hologram with the given armorStandUniqueId and lineArmorStandUniqueIds has been hidden using hideHologram before, this function will make it visible again.

Link copied to clipboard

Updates all lines of the given hologram. If the hologram doesn't exist, this function will throw IllegalStateException.