Welcome to the Hangar Open Beta. Please report any issue you encounter on GitHub!
Avatar for maximjsx

Packet-based text display library with animations, leaderboards, emojis, minimessage, and more!

Report HologramLib?

HologramLib banner

Discord Server Source code Wiki Javadocs

Packet-based holograms for your own plugins, and since 2.0.0 also a plugin with /holo commands and saved holograms.

PAPER ✅ PURPUR ✅ FOLIA ✅ 1.19.4 - 26.3 ✅

FEATURES

  • Types: text, block and item holograms, leaderboards (classic, paged, switchable, single display), podium, progress bars, paged holograms, hover menus, particle text and images, item labels
  • Text: MiniMessage, player heads in text without a resource pack (1.21.9+), ItemsAdder emojis, per-player text with or without PlaceholderAPI
  • Animations: typing, blink, moving gradient, shine, scramble, rainbow, reveal, cycle. Spin, floating, bounce, pulse, stretch, swing, shake, jelly, pop in/out or your own keyframes, interpolated on the client
  • Effects: path animations, transitions (flip, turn, squash, pop, slide, flap, drop, spin), shatter effect
  • Interactions: clickable holograms with a cancellable HologramInteractEvent, hover menus
  • Visibility: per-player viewers, view permission, view conditions, view distance, entity attachment
  • Standalone plugin: /holo command with tab completion, holograms saved in holograms.yml, click actions, import from DecentHolograms, FancyHolograms and HolographicDisplays
  • Packet-based: no real entities, PlaceholderAPI only sends a packet when a viewer's text changed

Run /holo demo on a test server to see every hologram type and animation around you.

disclaimer

Works on Paper, Purpur and Folia 1.19.4 - 26.3 (Folia from 1.20.1). Spigot is not supported. Requires PacketEvents 2.14.0 or newer. Holograms are display entities, a Java Edition feature. Bedrock players through Geyser don't see player heads in holograms. Persistent holograms are new. Keep a backup of holograms.yml when you update.

SETUP

  • Download the plugin .jar
  • Download PacketEvents 2.14.0 or newer
  • Put both .jar files into your server's plugins folder and restart
  • Create holograms in game with /holo, or add HologramLib as a dependency to your plugin

COMMANDS

Permission hologramlib.admin, aliases /holo and /hl.

commands
Command What it does
/holo create <id> text <text> Text hologram where you stand, \n starts a new line
/holo create <id> item [item] Item hologram, the held item by default
/holo create <id> block <block> Block hologram, like oak_stairs[facing=east]
/holo content <id> <content> Changes the text, item or block
/holo info <id> Shows every setting
/holo list All saved holograms
/holo near [radius] Saved holograms close to you
/holo tp <id> Teleports you to it
/holo movehere <id> Moves it to you
/holo copy <id> <new id> Copies it to where you stand
/holo delete <id> Deletes it
/holo scale <id> <scale|x y z> Changes the size
/holo billboard <id> <fixed|vertical|horizontal|center> How it turns to the player
/holo background <id> <#AARRGGBB|none> Background color of a text hologram
/holo shadow <id> <true|false> Text shadow
/holo placeholders <id> <true|false> PlaceholderAPI per player
/holo permission <id> <permission|none> Only players with it see it
/holo action <id> add <type:data> Adds a click action
/holo action <id> clear Removes all click actions
/holo import <decentholograms|fancyholograms|holographicdisplays> Imports holograms from another plugin
/holo demo [clear] Spawns every feature around you
/holo help Lists every command

Click actions ({player} is replaced with the player's name)

message:<green>Hello {player}
command:spawn
console:give {player} diamond 1
sound:block.note_block.pling:1:2
teleport:world:0:64:0
connect:lobby
permission:vip.reward    (stops the actions after it if the player lacks it)

All messages can be changed in plugins/HologramLib/messages.yml.

PROJECT SETUP

View the installation guide on GitHub

steps

Gradle (Kotlin)

repositories {
    maven("https://jitpack.io")
}

dependencies {
    compileOnly("com.github.maximjsx:HologramLib:2.0.0")
}

Gradle (Groovy)

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    compileOnly 'com.github.maximjsx:HologramLib:2.0.0'
}

Maven

<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>
<dependency>
    <groupId>com.github.maximjsx</groupId>
    <artifactId>HologramLib</artifactId>
    <version>2.0.0</version>
    <scope>provided</scope>
</dependency>

You need to add this line to your plugin.yml:

depend:
  - HologramLib

Shading HologramLib is not recommended. Install it on the server instead.

CODE EXAMPLES

Getting the instance

private HologramManager hologramManager;

@Override
public void onEnable() {
    HologramLib.getManager().ifPresentOrElse(
            manager -> hologramManager = manager,
            () -> getLogger().severe("HologramLib is not loaded"));
}

Text Hologram

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)
    .setMaxLineWidth(200);

Item Hologram

ItemHologram hologram = new ItemHologram("unique_id")
    .setItem(new ItemStack.Builder()
        .type(ItemTypes.DIAMOND_SWORD)
        .build())
    .setGlowing(true)
    .setGlowColor(Color.ORANGE)
    .setOnFire(false)
    .setDisplayType(ItemDisplayMeta.DisplayType.FIXED)
    .setBillboard(Display.Billboard.VERTICAL)
    .setScale(2.0F, 2.0F, 0.01F);

Block Hologram

int state = WrappedBlockState.getByString("minecraft:oak_stairs[facing=east]").getGlobalId();
BlockHologram hologram = new BlockHologram("unique_id")
    .setBlock(state)
    .setScale(0.5F, 0.5F, 0.5F)
    .setTranslation(-0.25F, 0, -0.25F); // block displays grow from their corner

Spawning a hologram

hologramManager.spawn(hologram, location);
hologramManager.remove(hologram);

Make it move and react

hologram.setTextProvider(player -> "<gold>Hey " + player.getName());
hologramManager.applyMotion(hologram, MotionAnimation.floating(0.2F, 40));
hologramManager.applyAnimation(hologram, TextAnimation.typing("<aqua>", "Welcome to the server"));
hologram.onInteract(player -> player.sendMessage("You clicked me"));

Leaderboard creation

LeaderboardHologram leaderboard = new LeaderboardHologram(LeaderboardHologram.LeaderboardOptions.builder()
        .title("Top Players - Kills")
        .suffix("kills")
        .maxDisplayEntries(10)
        .showEmptyPlaces(true)
        .leaderboardType(LeaderboardHologram.LeaderboardType.TOP_PLAYER_HEAD)
        .build(), "top_kills");

leaderboard.setPlayerScore(uuid, "MaximDe", 1000);
leaderboard.setPlayerScore(otherUuid, "dream", 950);

hologramManager.spawn(leaderboard, location);

// Update a score later, the leaderboard refreshes itself
leaderboard.setPlayerScore(uuid, "MaximDe", 1200);

Text leaderboard (the whole board in one text display, with toggles and animated rows)

TextLeaderboard board = new TextLeaderboard("kills")
        .setTitle("<gold><bold>Top Kills")
        .setEntries(List.of(new TextLeaderboard.Entry(uuid, "MaximDe", 120)))
        .addToggle(TextLeaderboard.Toggle.of("period", "Daily", "Weekly", "Lifetime"))
        .setTransition(Transition.FLIP)
        .setCycle(200);
hologramManager.spawn(board, location);

You can find more information on the wiki and in the GitHub readme. Using an AI assistant? Give it llms.txt, a compact reference of the whole API.

Leaderboard hologram with player heads, places and kill counts

SUPPORT

Problems with HologramLib?

Before you write a bad review ask for support on the discord server or open an issue on github

Discord bStats

HologramLib collects anonymous usage statistics with bStats. You can turn this off in plugins/bStats/config.yml.

Do not use the review section below for suggestions/feature requests or support.

Information

Category
Developer Tools
Published
December 28, 2024
License
GPL
329Downloads
6Stars
Library Supports Folia

Pinned Versions

Members

1