- Text animations
- Minimessage support
- Packet based
- Per player holograms
- Dynamic leaderboard creation
- Advanced hologram customization
- Attachment and parenting support
- Flexible rendering modes
- Download packet events https://www.spigotmc.org/resources/80279/
- Download HologramLib-[version].jar file from the latest release
- Upload the HologramLib-[version].jar and packet events file on your server (yourserver/plugins folder)
- Add the plugin as a dependency to your plugin and use it
Gradle installation
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
compileOnly 'com.github.max1mde:HologramLib:1.5.0.1'
}
Maven installation
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.max1mde</groupId>
<artifactId>HologramLib</artifactId>
<version>1.5.0.1</version>
<scope>provided</scope>
</dependency>
Add this to your plugin
plugin.yml
depend:
- HologramLib
https://github.com/max1mde/ExampleHologramPlugin
private HologramManager hologramManager;
@Override
public void onEnable() {
hologramManager = HologramLib.getManager().orElse(null);
if (hologramManager == null) {
getLogger().severe("Failed to initialize HologramLib manager.");
return;
}
}
Important
If you are shading the library use HologramLib.getManager(<Your plugin instance>)
instead!
// Different rendering modes available
TextHologram hologram = new TextHologram("example", RenderMode.NEARBY);
// Modes include:
// - NEARBY: Render for players near the hologram
// - ALL: Render for all online players
// - VIEWER_LIST: Render only for manually added viewers
// - NONE: Do not render
Note
Display.Billboard.CENTER = the hologram rotates to the player like a nametag (default value) Display.Billboard.FIXED = The holograms rotation is fixed Display.Billboard.VERTICAL = The hologram only rotates to the left and right (is horizontally fixed) Display.Billboard.HORIZONTAL = The hologram only rotates up and down (is vertically fixed)
TextHologram hologram = new TextHologram("unique_id")
.setMiniMessageText("<aqua>Hello world!")
.setSeeThroughBlocks(false)
.setBillboard(Display.Billboard.VERTICAL)
.setShadow(true)
.setScale(1.5F, 1.5F, 1.5F)
.setTextOpacity((byte) 200)
.setBackgroundColor(Color.fromARGB(60, 255, 236, 222).asARGB())
.setAlignment(TextDisplay.TextAlignment.CENTER)
.setViewRange(1.0)
.setMaxLineWidth(200);
hologramManager.spawn(hologram, location);
![](https://private-user-images.githubusercontent.com/114857048/395884693-68b8ded4-c307-44e9-a746-6777ff9b6205.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MjUxOTgsIm5iZiI6MTczOTYyNDg5OCwicGF0aCI6Ii8xMTQ4NTcwNDgvMzk1ODg0NjkzLTY4YjhkZWQ0LWMzMDctNDRlOS1hNzQ2LTY3NzdmZjliNjIwNS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNVQxMzA4MThaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT03MGI5MmJhNTllZTkzZjBhZWM5YTNkOTA0YjNmMTQ0ODBlZTE0ODVkMWY1Y2Y2OTlhYTRkOGI1OWQwZGJjYmM0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.DMYlDJ6ZP-V8Agyk3PeLnxmpsgtqByCxmEz2qHK6Vsw)
Map<Integer, String> leaderboardData = new LinkedHashMap<>() {{
put(1, "PlayerOne:1000");
put(2, "PlayerTwo:950");
put(3, "PlayerThree:900");
// ... more entries
}};
TextHologram leaderboard = hologramManager.generateLeaderboard(
location,
leaderboardData,
HologramManager.LeaderboardOptions.builder() // There are even more options in this builder like the title and footer design
.title("Top Players")
.showEmptyPlaces(true)
.scale(1.2f)
.maxDisplayEntries(10)
.suffix("kills")
.build()
);
/*
Update the leaderboard later if needed
*/
hologramManager.updateLeaderboard(
leaderboard,
updatedData,
HologramManager.LeaderboardOptions.builder().build()
);
hologramManager.attach(hologram, parentEntityId);
hologram.addViewer(player);
hologram.removeViewer(player);
hologram.removeAllViewers();
// The players who see the hologram
List<Player> currentViewers = hologram.getViewers();
hologram.setTranslation(0, 1, 0)
.setLeftRotation(0, 1, 0, 0)
.setRightRotation(0, 1, 0, 0)
.update(); // Apply changes (make them visible to the player)
Optional<TextHologram> retrievedHologram = hologramManager.getHologram("unique_id");
hologramManager.remove("unique_id");
hologramManager.remove(hologram);
hologramManager.removeAll();
Contributions to this repo or the example plugin are welcome!