PlaceholderAPI is a simple library for handling placeholders in PowerNukkitX plugins. It supports both static and dynamic placeholders with parameters.
StaticPlaceholder: Placeholders without parameters.
VisitorPlaceholder: Placeholders with parameters.
Supports parsing parameters using String[] for dynamic placeholders.
Default Placeholders
%player%: The players username
%player_nametag% - The players nametag
%player_displayname%: The players displayname
%player_uuid%: The players uuid
%player_xuid% - The players xuid
%player_ping%: The players ping
%player_level%: The name of the world the player is in
%player_health%: The players health
%player_max_health%: The players max health
%player_saturation%: The players food saturation
%player_food%: The players food level
%player_max_food%: The players max food
%player_gamemode%: The players gamemode (numerical)
%player_exp%: The players experience
%player_exp_level%: The players experience level
%player_platform%: The players platform
%player_pos%: The players position (also can do player_pos;x for just x etc.)
%player_item% - The item the player is holding in his hand
%player_offhand% - The item the player is holding in his offhand
%server_online%: The amount of players on the server
%server_max_players%: The player limit of the server
%server_motd%: The servers message of the day
%server_tps%: The servers tps
%server_tick% - The servers current tick
%server_difficulty% - The servers difficulty
%server_git% - The servers git version
%server_version% - The servers minecraft version
%server_protocol% - The servers protocol version
%time%: The servers date time (also can do time;HH:mm:ss / Other format)
How to Use
1. Register a Static Placeholder
You can register a static placeholder using the StaticPlaceholder class:
PlaceholderAPI.get().register("server_name", new StaticPlaceholder(() -> "My Nukkit Server"));
2. Register a Dynamic Placeholder with Parameters
For placeholders with parameters, use the VisitorPlaceholder class:
PlaceholderAPI.get().register("player_stat", new VisitorPlaceholder((player, params) -> {
if (params.length == 0) {
return "No stat provided!";
}
String stat = params[0];
switch (stat) {
case "kills":
return "10 Kills"; // Replace with your logic
case "deaths":
return "5 Deaths"; // Replace with your logic
default:
return "Unknown stat: " + stat;
}
}));