NPCs & Holograms

NPCs & Holograms

View as Markdown ·

On this page

circle-info

Everything on this page needs PhoenixNPCs or PhoenixHolograms on the same server. Both are picked up on their own, even when they load after this plugin, and nothing has to be set up.

#Currency Actions

Three action types are added to the click actions of PhoenixNPCs and PhoenixHolograms, so an NPC or a hologram can sell, reward or check for any currency. They show in the action builder of both editors.

Action Does
[CURRENCY_GIVE] <currency> <amount> Gives the player the amount.
[CURRENCY_TAKE] <currency> <amount> Takes the amount from the player.
[CURRENCY_REQUIRE] <currency> <amount> Checks that the player has at least the amount, without taking it.

The currency is its id and the amount accepts the short forms, such as [CURRENCY_TAKE] gems 50 or [CURRENCY_GIVE] money 2.5k.

When an action fails, the player is told why and the actions after it do not run: a take or a require the player cannot afford, or a give that would go past the maximum balance. So put the take first and the reward after it. A player whose balances are still loading right after joining is asked to try again.

YAML
- '[CURRENCY_TAKE] gems 50'
- '[COMMAND] console; give %player% diamond_sword 1'
- '[MESSAGE] &aEnjoy your sword!'

Changes made this way are logged in the transaction log with NPC or Hologram as the reason and the NPC's or hologram's id as who made them. An action with a currency that does not exist or a wrong amount is reported in the console, and the player is told something went wrong.

#Leaderboard Hologram

The Leaderboard Hologram button of a currency's editor creates a PhoenixHolograms leaderboard of that currency where you stand, already filled with its top placeholders. It shows up to 10 rows, or the leaderboard size when that is lower, and is named after the currency, such as gems_leaderboard.

It is a normal saved hologram from then on: change its look, rows and lines in /pholo editor. It needs PhoenixHolograms and PlaceholderAPI, and its rows stay empty while the currency's Leaderboard is off. The button says so in each case. The header, footer and row formats it starts with are in the translation file.

My Cart
Spider

Your cart is empty

Looks like the spiders padded through here. Pick a plugin and it will show up here. Continue shopping