Skip to content

Hologram API

Rick van Sloten edited this page Apr 12, 2020 · 1 revision

Hologram API

This wiki page is all about the Hologram API feature! Many high end plugin use holograms as a spatial way of showing text. TabuuCore helps to make integrating Holograms easy. If you want to learn more; check out the HologramAPI javadoc.

Introduction

Before you create a hologram it is important to know how they work. In TabuuCore they function similar to a BossBar, they are invisible until shown to a player. Much of the hologram is handled client-sided, holograms are not just invisible when not shown, they do not exist on the client. All holograms are removed after a server reload, this is to prevent garbage from building.

Creating a hologram

To create a new hologram you must first get the HologramAPI like so:

HologramAPI hologramAPI = HologramAPI.getInstance();

After this you can call the create function, which takes the location, and a string parameter as arguments. This will create a hologram at the player's location, with 3 lines. It is possible to edit the location and lines later with their corresponding setters.

IHologram hologram = hologramAPI.create(player.getLocation(), "Line 1", "Line 2", "Line 3");

The last thing you have to do is to add a player to a hologram, this will subscribe the player to the hologram make the hologram visible to that player.

hologram.addPlayer(player);

Clone this wiki locally