Skip to content

Runtime Updates

wjddusrb03 edited this page Mar 29, 2026 · 1 revision

Runtime Updates

Update display properties after spawning.

Methods

SpawnedDisplay display = DisplayAPI.getById("my-display");

Text Updates

display.updateText(Component.text("New text").color(NamedTextColor.RED));
display.updateText("Plain text shorthand");

Block Updates

display.updateBlock(Material.GOLD_BLOCK);
display.updateBlock(Material.OAK_STAIRS.createBlockData("[facing=north]"));

Item Updates

display.updateItem(new ItemStack(Material.DIAMOND_SWORD));
display.updateItem(Material.BOW);

Visual Properties

display.setGlowing(true);
display.setGlowColor(Color.RED);
display.setBillboard(Billboard.FIXED);

Movement

// Instant teleport
display.teleport(newLocation);

// Smooth teleport (interpolated over ticks, max 59)
display.smoothTeleport(newLocation, 5);

Lifecycle

display.isAlive();     // Check if entity still exists
display.remove();      // Remove the entity
display.getEntity();   // Access underlying Display entity
display.getLocation(); // Current location

Finding Displays

// By ID
SpawnedDisplay display = DisplayAPI.getById("my-id");

// Remove by ID
DisplayAPI.remove("my-id");

// Remove all
DisplayAPI.removeAll();

Example: Cycling Text

SpawnedDisplay display = DisplayAPI.text(location)
    .text(Component.text("Message 1"))
    .noBackground()
    .id("cycling")
    .spawn();

String[] messages = {"Message 1", "Message 2", "Message 3"};
new BukkitRunnable() {
    int index = 0;
    public void run() {
        if (!display.isAlive()) { cancel(); return; }
        display.updateText(Component.text(messages[index % messages.length]));
        index++;
    }
}.runTaskTimer(plugin, 0L, 60L); // Every 3 seconds

Clone this wiki locally