API
Including the API into your project
Gradle
repositories {
maven("https://repo.fancyplugins.de/releases")
maven("https://jitpack.io")
...
}
dependencies {
compileOnly("de.oliver:FancyHolograms:version")
...
}
Maven
<repository>
<id>fancyplugins-releases</id>
<name>FancyPlugins Repository</name>
<url>https://repo.fancyplugins.de/releases</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>de.oliver</groupId>
<artifactId>FancyHolograms</artifactId>
<version>VERSION</version>
</dependency>
JavaDoc
You can find the JavaDoc here
Create a new hologram
HologramManager manager = FancyHologramsPlugin.get().getHologramManager();
DisplayHologramData displayData = DisplayHologramData.getDefault(location);
displayData.setBillboard(Display.Billboard.FIXED);
// set more general data here
TextHologramData textData = TextHologramData.getDefault("hologram_name"); // or create BlockHologramData / ItemHologramData
textData.setBackground(TextColor.color(100, 255, 79));
// set more type-specific data here
HologramData data = new HologramData("hologram_name", displayData, HologramType.TEXT, textData);
Hologram hologram = manager.create(data);
manager.addHologram(hologram); // registers the hologram (FancyHolograms will save and load it)
hologram.createHologram();
hologram.showHologram(Bukkit.getOnlinePlayers());
Modify an existing hologram
HologramManager manager = FancyHologramsPlugin.get().getHologramManager();
Hologram holo = manager.getHologram("hologram_name").orElse(null);
if (holo == null) {
// hologram not found
return;
}
holo.getData().getDisplayData().setBillboard(Display.Billboard.CENTER);
if (holo.getData().getTypeData() instanceof TextHologramData textData) {
textData.setTextAlignment(TextDisplay.TextAlignment.LEFT);
}
// apply the changes
holo.updateHologram();
// refresh the hologram for all players
holo.refreshHologram(Bukkit.getOnlinePlayers());
// if refreshing did not work, try to respawn the hologram
holo.hideHologram(Bukkit.getOnlinePlayers());
holo.showHologram(Bukkit.getOnlinePlayers());
Help about the API
Last modified: 03 March 2024