Source: https://www.spigotmc.org/resources/holograms.4924/
- Source Code:
- https://github.com/sainttx/Holograms
- Contributors:
- SainttX
Holograms
Holograms is an implementation of text and item holograms in a CraftBukkit/Spigot server environment. It’s creation was inspired by filoghost’s HolographicDisplays and was initially created to be a stripped implementation. Over time, the plugin has matured and now features a fully expansive API for developers which allows many different possibilities.
- Bug reports: https://github.com/sainttx/Holograms/issues
- Source code: https://github.com/sainttx/Holograms
Features
- Standard text hologram lines
- Floating item hologram lines
- Animated text hologram lines
- Animated item hologram lines
- Placeholder support (https://www.spigotmc.org/resources/holograms-placeholders.19813/)
- Highly intuitive and expansive API for developers
Usage (in-game)
The plugin currently offers a variety of commands for management of your Holograms:
- /holograms addline <hologramName> <textToAdd>
- /holograms create <hologramName> <initialText>
- /holograms delete <hologramName>
- /holograms import <plugin>
- /holograms info <hologramName>
- /holograms insertline <hologramName> <index> <textToAdd>
- /holograms list
- /holograms movehere <hologramName>
- /holograms near <radius>
- /holograms removeline <hologramName> <index>
- /holograms refresh
- /holograms setline <hologramName> <index> <text>
All commands use the permission structure “holograms.<subcommand>” (ie. /holograms near would use the permission holograms.near).
Using Holograms (Developers)
To use Holograms in your plugins, add the Holograms-API module to your build path. Then add Holograms as a dependency in your plugin yml file:
Hologram creation is made easy with our API. Get a reference to the HologramManager and you’re set.
@Override
public void onEnable() {
this.hologramManager = JavaPlugin.getPlugin(HologramPlugin.class).getHologramManager();
}
Creating and Modifying Holograms
Once you have the reference, you can easily work your way around the APIs offerings:
Hologram hologram = new Hologram(id, location);
hologramManager.addActiveHologram(hologram); // Tells the plugin a new Hologram was added
}
Adding lines is easy as well:
HologramLine line = new TextLine(hologram, text);
hologram.addLine(line);
}
public void addItemLine(Hologram hologram, ItemStack itemstack) {
HologramLine line = new ItemLine(hologram, itemstack);
hologram.addLine(line);
}
Removing Holograms
You can permanently remove a hologram (incl. persistence) by doing the following:
hologramManager.deleteHologram(hologram);
}
Or if you want to temporarily hide a persistent hologram until the server restarts:
hologram.despawn();
hologramManager.removeActiveHologram(hologram);
}