Your cart is empty
Looks like the spiders padded through here. Pick a plugin and it will show up here. Continue shoppingRead holograms, turn their pages, or create holograms of your own from code.
<repositories>
<repository>
<id>phoenixplugins</id>
<url>https://repo.phoenixplugins.com/repository/maven-public/</url>
</repository>
</repositories>
<dependency>
<groupId>com.phoenixplugins.phoenixholograms</groupId>
<artifactId>api</artifactId>
<version>1.3.0</version>
</dependency>
Add PhoenixHolograms to your plugin.yml so your plugin loads after it.
depend: [PhoenixHolograms]
PhoenixHologramsAPI.get() returns the service as an Optional, empty while the plugin is not enabled. Call it from the main thread. On Folia any region thread or the global region thread works; changes for a player are applied on that player's region.
PhoenixHologramsAPI.get().ifPresent(holograms -> holograms.setPage(player, "lobby", 2));
| Method | Returns |
|---|---|
getIdentifiers(), exists(String id)
|
The ids of every hologram, and whether one exists |
getLocation(String id) |
Where a hologram stands, as an Optional
|
getPage(Player, String id), getPageCount(String id)
|
The page a player sees, from 1, and how many pages there are |
setPage(Player, String id, int page) |
Shows a player a page, from 1 |
refresh(String id) |
Redraws a hologram |
isValidIdentifier(String id) |
Whether an id is allowed |
create(Plugin owner, String id, Location location) |
A new hologram of your own, see below |
getHandle(String id) |
The handle of a hologram, as an Optional
|
remove(String id), removeAll(Plugin owner)
|
Removes one hologram, or every hologram your plugin made |
createPersistent(String id, Location location) |
A new saved hologram, the same as one made with /pholo create, see below |
registerAction(String type, String syntax, HologramActionHandler handler) |
Adds a click action type, see Custom Actions |
unregisterAction(String type) |
Removes an action type you added |
showDamageIndicator(Location at, double amount, boolean critical) |
Shows a damage indicator at a spot |
A hologram made with create is never saved and never listed in the editor or /pholo list. It stays through /pholo reload and is removed when your plugin disables.
The returned HologramHandle changes it. Lines take the same text as the editor, placeholders and tokens included.
HologramHandle handle = holograms.create(this, "my_plugin_spawn", location);
handle.setLines(Arrays.asList("&6&lSpawn", "&7Welcome, %player%"));
setLocation redraws the hologram, while teleport slides it to the new spot and is cheap enough to call every tick. After setManualVisibility(true) only the players added with setManualViewer see the hologram, still within its view distance. setViewPermission replaces the hologram's Permission view conditions with one for that node, and an empty node removes them.
Pages are counted from 1 and lines from 0, the same as getPage and setLine. A line method on a page that does not exist throws an IllegalArgumentException; addLine and insertLine on the page after the last one create it.
| Methods | What they change |
|---|---|
getLines, setLines, setLine(int, String), setPages
|
The text lines of page 1, or every page as text |
getPageCount, addPage, removePage
|
The pages |
getLines(page), getLine(page, index), addLine, insertLine, setLine(page, index, LineSpec), removeLine, setLinePages
|
Lines of any type on any page, see Lines |
getActions, setActions, setLineActions, setClickPermission, setClickCooldown
|
Click actions of the hologram and of one line, per ClickType: LEFT, RIGHT, SHIFT_LEFT, SHIFT_RIGHT or ANY
|
setLineConditions, getViewConditions, setViewConditions
|
Line conditions and view conditions, see Conditions |
getRegions, setRegions, setViewPermission, setVisibleTo, setManualVisibility, setManualViewer, setViewDistance, setUpdateInterval
|
Visibility |
getAppearance, setAppearance, setScale, setBackground
|
Appearance, see Appearance |
isEnabled, setEnabled, setPageInterval
|
Whether it shows at all, and the page rotation |
getLocation, setLocation, teleport
|
Where it stands |
moveBy(x, y, z) |
Moves it by an amount of blocks. On a hologram linked to an NPC only y may be set, and it changes the height above the NPC; returns false when the move is refused |
linkNpc, getLinkedNpc, unlinkNpc, getLinkOffsetY, setLinkOffsetY
|
The NPC link and the height above the NPC's name, up to 16 blocks either way |
getLeaderboard, setLeaderboard
|
The leaderboard settings, see Leaderboards |
remove |
Removes a hologram made by code |
A LineSpec is built from one of LineSpec.text, item (a Material, an ItemStack or a hook id such as nexo:ruby), head, image or command, then any line option: scale, height, spin, bob, glow, rotation, offset, shadow, the style overrides, the effects, click actions and conditions. A style override left out follows the hologram. toBuilder() makes a changed copy of a line read with getLine.
handle.addLine(1, LineSpec.item(Material.DIAMOND).spin(90).glow(true)
.action(ClickType.RIGHT, "[MESSAGE] &bShiny!").build());
handle.addLine(1, LineSpec.text("&eHello").billboard(Billboard.FIXED).rotation(45, 0).hoverText("&aHi").build());
An item the server does not know throws an IllegalArgumentException. A command line runs as the console; your plugin decides who may set one.
ConditionSpec.permission(node), ConditionSpec.noPermission(node) or ConditionSpec.compare(placeholder, ConditionType.GREATER_OR_EQUAL, "10"). Every condition has to pass.
Appearance.builder() with any of billboard, scale, line gap, shadow, see-through, background, opacity, alignment, line width, brightness, spin, rotation, offset, double-sided, fade ticks and the three freeze switches. setAppearance only changes the values that were set, so a builder with one value changes one option.
handle.setAppearance(Appearance.builder().billboard(Billboard.VERTICAL).fade(10).build());
setLeaderboard takes a LeaderboardSpec. LeaderboardSpec.builder(value) ranks a value the plugin tracks per player, with period, yourRank, the row formats, size and refresh of the editor. null removes the settings. The players show on rank lines: LineSpec.Builder.rank(n), yourRank() and rankText(format) on text and head lines.
handle.setLeaderboard(LeaderboardSpec.builder("statistic:PLAYER_KILLS")
.period(LeaderboardPeriod.WEEKLY).yourRank("&7You: #{rank} {value}").build());
handle.addLine(LineSpec.head("").rank(1).build());
handle.addLine(LineSpec.text("").rank(1).build());
handle.addLine(LineSpec.text("").yourRank().build());
createPersistent makes a hologram that belongs to the server rather than your plugin: it is saved like every other hologram, synced to other servers when sync is on, listed in the editor, and admins edit or delete it like any other. It takes the defaults of config.yml and needs a location in a loaded world. The returned handle fills it in, for example with a leaderboard.
showDamageIndicator floats a damage number up from a spot, the same as a hurt mob gets, to the players nearby. critical uses the critical wording. It follows the damage indicator settings, so nothing shows while indicators or Damage are off, in a disabled world, or for an amount of 0 or less. On Folia the number is shown on the region of the spot.
holograms.showDamageIndicator(npc.getLocation().add(0, 2, 0), 7.5, false);
A registered type shows in the editor's action builder with a single text field, and runs on hologram and line clicks like the built-in ones. The handler gets the hologram's id, the player and everything after the type. Return false to stop the actions after it.
holograms.registerAction("QUEST", "<quest>", (hologram, player, argument) -> quests.start(player, argument));
Unregister it in your onDisable. PhoenixCurrencies uses this for its currency actions.
HologramsLoadEvent fires after every load of the plugin, so a plugin can make its holograms again after PhoenixHolograms was reloaded or replaced.
Your guide to the docs
Ask me anything about our plugins. I know these docs inside out, check the latest versions and changelogs, and can read your server logs.
Try asking
Your cart is empty
Looks like the spiders padded through here. Pick a plugin and it will show up here. Continue shopping