Skip to content

Quick Start KO

wjddusrb03 edited this page Mar 29, 2026 · 1 revision

빠른 시작

첫 번째 디스플레이

import com.wjddusrb03.displayapi.DisplayAPI;
import com.wjddusrb03.displayapi.display.SpawnedDisplay;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.entity.Display.Billboard;

// 간단한 텍스트 홀로그램 생성
SpawnedDisplay display = DisplayAPI.text(location)
    .text(Component.text("안녕하세요!").color(NamedTextColor.GOLD))
    .billboard(Billboard.CENTER)
    .noBackground()
    .spawn();

자주 쓰는 패턴

NPC 이름표

DisplayAPI.text(npc.getLocation().add(0, 2.2, 0))
    .text(Component.text("상점 주인").color(NamedTextColor.GREEN))
    .billboard(Billboard.CENTER)
    .noBackground()
    .shadowed(true)
    .spawn();

데미지 표시

@EventHandler
public void onDamage(EntityDamageByEntityEvent e) {
    if (!(e.getDamager() instanceof Player attacker)) return;

    double damage = e.getFinalDamage();
    DisplayAPI.popup(e.getEntity().getLocation().add(0, 1.5, 0))
        .text(Component.text(String.format("-%.1f", damage)).color(NamedTextColor.RED))
        .duration(25)
        .startScale(1.2f)
        .endScale(0.3f)
        .visibleTo(attacker)
        .spawn();
}

떠다니는 아이템 전시

SpawnedDisplay item = DisplayAPI.item(location)
    .item(new ItemStack(Material.NETHER_STAR))
    .billboard(Billboard.CENTER)
    .spawn();

DisplayAPI.animate(item).floating(0.3f, 40).loop(true).play();
DisplayAPI.animate(item).spin(AnimationBuilder.Axis.Y, 60).loop(true).play();

인터랙티브 버튼

DisplayAPI.interactive(location)
    .text(Component.text("[텔레포트]").color(NamedTextColor.AQUA))
    .hitbox(2.0f, 0.8f)
    .scale(1.5f)
    .onClick(player -> {
        player.teleport(targetLocation);
        player.sendMessage("텔레포트 완료!");
    })
    .spawn();

플레이어 체력 표시 (팔로우)

SpawnedDisplay hp = DisplayAPI.text(player.getLocation().add(0, 2.5, 0))
    .text(Component.text("HP: 20").color(NamedTextColor.RED))
    .noBackground()
    .billboard(Billboard.CENTER)
    .spawn();

DisplayAPI.follow(hp, player)
    .offset(0, 2.5, 0)
    .smoothTeleport(3)
    .start();

여러 줄 홀로그램

var anchor = location.clone().add(0, 2, 0);
var group = DisplayAPI.group("info-board", anchor);

group.add(DisplayAPI.text(anchor)
    .text(Component.text("서버 정보").color(NamedTextColor.GOLD))
    .noBackground().spawn());

group.add(DisplayAPI.text(anchor.clone().add(0, -0.3, 0))
    .text(Component.text("플레이어: 10/100").color(NamedTextColor.GRAY))
    .noBackground().spawn());

group.add(DisplayAPI.text(anchor.clone().add(0, -0.6, 0))
    .text(Component.text("TPS: 20.0").color(NamedTextColor.GREEN))
    .noBackground().spawn());

DisplayAPI.getManager().registerGroup(group);

다음 단계

Clone this wiki locally