-
Notifications
You must be signed in to change notification settings - Fork 0
DisplayGroup
wjddusrb03 edited this page Mar 29, 2026
·
1 revision
Groups multiple SpawnedDisplays together for batch operations (move, remove).
DisplayGroup group = DisplayAPI.group("my-group", anchorLocation);
group.add(display1);
group.add(display2);
group.add(display3);
DisplayAPI.getManager().registerGroup(group);| Method | Description |
|---|---|
.add(SpawnedDisplay) |
Add a display to the group |
.remove(SpawnedDisplay) |
Remove a specific display |
.teleport(Location) |
Move all displays (preserving relative positions) |
.remove() |
Remove all displays in group |
.cleanup() |
Remove dead displays from tracking |
.size() |
Number of displays |
.isAlive() |
True if any display is alive |
.getId() |
Group identifier |
.getDisplays() |
List of all displays |
When you call group.teleport(newLocation), it calculates the offset from the anchor and moves each display by the same delta, preserving their relative positions.
Location anchor = location.clone().add(0, 3, 0);
DisplayGroup group = DisplayAPI.group("info", anchor);
group.add(DisplayAPI.text(anchor)
.text(Component.text("Title").color(NamedTextColor.GOLD))
.noBackground().spawn());
group.add(DisplayAPI.text(anchor.clone().add(0, -0.3, 0))
.text(Component.text("Line 2").color(NamedTextColor.GRAY))
.noBackground().spawn());
group.add(DisplayAPI.text(anchor.clone().add(0, -0.6, 0))
.text(Component.text("Line 3").color(NamedTextColor.GRAY))
.noBackground().spawn());
DisplayAPI.getManager().registerGroup(group);DisplayGroup group = DisplayAPI.getManager().getGroupById("info");
group.teleport(newLocation);DisplayAPI.getManager().removeGroup("info");