FancyInnovations

Text Holograms (v2)

Creating and managing text holograms in v2

This documentation is for FancyHolograms v2. For the latest version (v3), see Text Holograms v3.

Text holograms in v2 display formatted text in the world with support for MiniMessage formatting and PlaceholderAPI.

Creating a text hologram

Basic creation

import de.oliver.fancyholograms.api.data.TextHologramData;
import de.oliver.fancyholograms.api.FancyHologramsPlugin;
import de.oliver.fancyholograms.api.HologramManager;
import org.bukkit.Location;
import java.util.List;

Location location = new Location(world, 100, 64, 200);

// Create text hologram data
TextHologramData data = new TextHologramData("my_text_holo", location);
data.setText(List.of(
    "<rainbow>Rainbow Text</rainbow>",
    "<gold>Golden Line</gold>"
));

// Create and add hologram
HologramManager manager = FancyHologramsPlugin.get().getHologramManager();
Hologram hologram = manager.create(data);
manager.addHologram(hologram);

Text properties

Setting text

import java.util.List;

// Set all lines at once
data.setText(List.of("Line 1", "Line 2", "Line 3"));

// Add a single line
data.addLine("<green>New line</green>");

// Remove a line by index
data.removeLine(1);

// Get current text
List<String> lines = data.getText();

Text formatting

FancyHolograms v2 supports MiniMessage formatting:

// Colors
data.setText(List.of("<red>Red text</red>"));
data.setText(List.of("<#FF5555>Hex color</hex>"));

// Gradients
data.setText(List.of("<gradient:red:blue>Gradient</gradient>"));

// Rainbow
data.setText(List.of("<rainbow>Rainbow!</rainbow>"));

// Formatting
data.setText(List.of(
    "<bold>Bold</bold>",
    "<italic>Italic</italic>",
    "<underline>Underlined</underline>"
));

Text alignment

import org.bukkit.entity.TextDisplay;

// Center (default)
data.setTextAlignment(TextDisplay.TextAlignment.CENTER);

// Left aligned
data.setTextAlignment(TextDisplay.TextAlignment.LEFT);

// Right aligned
data.setTextAlignment(TextDisplay.TextAlignment.RIGHT);

Background color

import java.awt.Color;

// Solid black background
data.setBackground(Color.BLACK);

// Semi-transparent background (RGBA)
data.setBackground(new Color(0, 0, 0, 128));

// Transparent (no background)
data.setBackground(new Color(0, 0, 0, 0));

// Get current background
Color bg = data.getBackground();

Text shadow

// Enable shadow
data.setTextShadow(true);

// Disable shadow
data.setTextShadow(false);

// Check if enabled
boolean hasShadow = data.hasTextShadow();

See-through text

// Enable see-through
data.setSeeThrough(true);

// Disable
data.setSeeThrough(false);

// Check status
boolean seeThrough = data.isSeeThrough();

Dynamic text updates

Make text update automatically for live information:

// Update every second (20 ticks)
data.setTextUpdateInterval(20);

// Update every 5 seconds (100 ticks)
data.setTextUpdateInterval(100);

// Disable updates
data.setTextUpdateInterval(-1);

// Get current interval
int interval = data.getTextUpdateInterval();

Display properties

Billboard mode

import org.bukkit.entity.Display;

// Always face player (default)
data.setBillboard(Display.Billboard.CENTER);

// Fixed orientation
data.setBillboard(Display.Billboard.FIXED);

// Vertical only
data.setBillboard(Display.Billboard.VERTICAL);

// Horizontal only
data.setBillboard(Display.Billboard.HORIZONTAL);

Scale

import org.joml.Vector3f;

// Uniform scale
data.setScale(new Vector3f(2.0f, 2.0f, 2.0f)); // Double size

// Non-uniform scale
data.setScale(new Vector3f(1.5f, 1.0f, 1.0f)); // Wider

// Get current scale
Vector3f scale = data.getScale();

Translation (offset)

import org.joml.Vector3f;

// Move up by 0.5 blocks
data.setTranslation(new Vector3f(0, 0.5f, 0));

// Offset in multiple directions
data.setTranslation(new Vector3f(0.1f, 0.2f, 0.3f));

// Get current translation
Vector3f translation = data.getTranslation();

Complete examples

Example: Server info display

public void createServerInfo(Location location) {
    TextHologramData data = new TextHologramData("server_info", location);
    data.setText(List.of(
        "<gradient:gold:yellow><bold>SERVER INFO</bold></gradient>",
        "",
        "<white>Players: <green>%server_online%/%server_max_players%</green></white>",
        "<white>TPS: <green>%server_tps%</green></white>"
    ));
    data.setBackground(new Color(0, 0, 0, 180));
    data.setTextAlignment(TextDisplay.TextAlignment.CENTER);
    data.setTextShadow(true);
    data.setTextUpdateInterval(20); // Update every second
    data.setScale(new Vector3f(1.5f, 1.5f, 1.5f));

    HologramManager manager = FancyHologramsPlugin.get().getHologramManager();
    Hologram hologram = manager.create(data);
    manager.addHologram(hologram);
}

Example: Welcome message

public void createWelcome(Location location) {
    TextHologramData data = new TextHologramData("welcome", location);
    data.setText(List.of(
        "<rainbow><bold>WELCOME</bold></rainbow>",
        "",
        "<gray>to our server!</gray>",
        "",
        "<gold>Type /help for assistance</gold>"
    ));
    data.setBackground(new Color(0, 0, 0, 100));
    data.setTextShadow(true);
    data.setScale(new Vector3f(2.0f, 2.0f, 2.0f));
    data.setBillboard(Display.Billboard.CENTER);

    HologramManager manager = FancyHologramsPlugin.get().getHologramManager();
    Hologram hologram = manager.create(data);
    manager.addHologram(hologram);
}

Updating text holograms

Update text content

HologramManager manager = FancyHologramsPlugin.get().getHologramManager();

manager.getHologram("my_text_holo").ifPresent(hologram -> {
    if (hologram.getData() instanceof TextHologramData textData) {
        // Update text
        textData.setText(List.of("<red>Updated!</red>"));

        // Queue update (batched)
        hologram.queueUpdate();

        // Or force immediate update
        hologram.forceUpdate();
    }
});

Refresh for specific players

// Refresh for all current viewers
hologram.refreshForViewers();

// Refresh for viewers in the same world
hologram.refreshForViewersInWorld();

// Refresh for specific players
Collection<Player> players = List.of(player1, player2);
hologram.refreshHologram(players);

PlaceholderAPI integration

If PlaceholderAPI is installed, use placeholders in text:

TextHologramData data = new TextHologramData("placeholders", location);
data.setText(List.of(
    "<gold>Players Online: %server_online%</gold>",
    "<aqua>Your Balance: $%vault_eco_balance%</aqua>",
    "<green>Rank: %luckperms_primary_group_name%</green>"
));
data.setTextUpdateInterval(40); // Update every 2 seconds

HologramManager manager = FancyHologramsPlugin.get().getHologramManager();
manager.addHologram(manager.create(data));

Visibility control

Manual visibility

import de.oliver.fancyholograms.api.data.property.Visibility;

// Set manual visibility mode
data.setVisibility(Visibility.MANUAL);

// Add viewer manually
Visibility.ManualVisibility.addDistantViewer(hologram, player.getUniqueId());

// Remove viewer
Visibility.ManualVisibility.removeDistantViewer(hologram, player.getUniqueId());

// Check if player can see
boolean canSee = Visibility.ManualVisibility.canSee(player, hologram);

Permission-based visibility

// Require permission to see
data.setVisibility(Visibility.PERMISSION_REQUIRED);
// Players need: fancyholograms.viewhologram.<name>

On this page