Skip to content

TextplaceholderAPI

CleverNucleus edited this page Sep 11, 2021 · 4 revisions

Starting from PlayerEx version 3.0.2, TextplaceholderAPI is being supported. This means that PlayerEx natively comes shipped with some placeholders, ready for use:

  • %playerex:level
    • This displays a player's level (provided they have the Level attribute, else displays 0).
  • %playerex:level_top/x%
    • This displays the player's name whose level is the highest on the server; where the argument x represents the position of the player in terms of level relative to everyone else. For example: x = 1 represents the player with the highest level; x = 2 represents the next highest level, and so on. The specific implementation is PlayerEntity#getName.

Notes

  • If for some reason a player does not have the playerex:level attribute, or the server itself does not have it registered, then the text placeholder %playerex:level will return the string n/a.
  • The placeholder %playerex:level_top/x% will return an empty string if the argument x exceeds the number of players on the server at that moment. I.e. if there are 5 players on the server and the text placeholder is setup as %playerex:level_top/6%, an empty string will be returned. If however, a 6th player joins, then that same text placeholder will return the relevant player name.