Skip to content
oolongho edited this page Jul 18, 2026 · 2 revisions

API

Basic Usage

import com.oolonghoo.holograms.api.WooHologramsAPI;
import com.oolonghoo.holograms.api.event.HologramClickEvent;
import com.oolonghoo.holograms.hologram.Billboard;
import com.oolonghoo.holograms.hologram.Brightness;
import com.oolonghoo.holograms.hologram.Hologram;
import com.oolonghoo.holograms.hologram.HologramLine;
import com.oolonghoo.holograms.hologram.HologramPage;
import com.oolonghoo.holograms.action.Action;
import com.oolonghoo.holograms.action.ActionType;
import com.oolonghoo.holograms.action.ClickType;

// Check if API is available
if (!WooHologramsAPI.isLoaded()) {
    return;
}

// Create a hologram (returns Optional)
Optional<Hologram> opt = WooHologramsAPI.createHologram("test", player.getLocation());
if (opt.isEmpty()) {
    player.sendMessage("Creation failed, name may already exist");
    return;
}
Hologram holo = opt.get();

// Add lines
HologramPage page = holo.getPage(0);
page.addLine("&aWelcome!");
page.addLine("#ICON:DIAMOND");
page.addLine("#BLOCK:GOLD_BLOCK");

// Page button: create text line + add NEXT_PAGE action
HologramLine nextLine = page.addLine("&aNext Page");
if (nextLine != null) {
    nextLine.addAction(ClickType.ANY, new Action(ActionType.NEXT_PAGE, holo.getName()));
}

// Set hologram-level Display properties
holo.setScale(1.5f, 1.5f, 1.0f);           // Scale
holo.setGlowColor(0xFF0000);                 // Glow color (pure RGB)
holo.setBrightness(new Brightness(15, 15));  // Brightness (sky light, block light)
holo.setChromaBackground(true);              // Chroma gradient background
holo.setChromaGlow(true);                    // Chroma gradient glow

// Non-TEXT lines can be overridden individually
HologramLine iconLine = page.getLine(1);
iconLine.setScale(2.0f, 2.0f, 2.0f);
iconLine.setShadowRadius(0.5f);
iconLine.setBillboard(Billboard.FIXED_ANGLE);
iconLine.setCustomYaw(90f);
iconLine.setCustomPitch(0f);

// Add actions
iconLine.addAction(ClickType.LEFT, new Action(ActionType.COMMAND, "spawn"));
page.addAction(ClickType.RIGHT, new Action(ActionType.MESSAGE, "&aClicked!"));

// Show to a player
holo.show(player);

// Get an existing hologram
Optional<Hologram> existing = WooHologramsAPI.getHologram("test");
existing.ifPresent(h -> h.show(player));

Event Listening

@EventHandler
public void onHologramClick(HologramClickEvent event) {
    Player player = event.getPlayer();
    Hologram hologram = event.getHologram();
    HologramPage page = event.getPage();
    ClickType clickType = event.getClickType();
}

Clone this wiki locally