PlaceholderAPI

PlaceholderAPI 1.3.3

Compatible API Versions
1.0.0
Sourcecode
https://github.com/Creeperface01/PlaceholderAPI-nukkit
Contributors
CreeperFace
PlaceholderAPI adds support for placeholders, so you can easily use the information from all plugins supporting PlaceholderAPI such as (Holograms, CustomMessages or LuckPerms) anywhere else.

How to use

Placeholders in texts must be surrounded with percent signs.​

example

"this is a text with placeholder %time%"​
%time% will be replaced with the actual time​

You can use multiple placeholders in one text.​
Parameters
since version 1.3 placeholders can contain parameters, which modify the final value, it can be a permission we want to check or the key of something and so on.​
parameters must be specified in the following format​
%placeholder<parameters>% - generic format​
%placeholder<param1=value1;param2=value2>% - PAPI supports named parameters which is usually used when you need to use multiple parameters, then it doesn't matter in what order you specifiy them. But it depends on the implementation of the plugin that provides the placeholders whether the naming is required or not. In general for single parameter the naming shouldn't be required.​
example
%has_permission<nukkit.command.time>% - checks if player has the permission nukkit.command.time​
%synapse_status<lobby;true=you can join;false=you can't join right now>% - returns synapse server status. When online then "you can join" otherwise "you can't join right now"
%player% - get the player's name
%player_displayname% - get the player's display name
%player_uuid% - get the player's UUID
%player_ping% - get the player's ping
%player_level% - get the player's level name
%player_can_fly% - Whether player is in the fly mode or not
%player_flying% - Whether player is flying or not
%player_health% - get the player's health
%player_max_health% - get the player's max health
%player_saturation% - get the player's saturation level
%player_food% - get the player's food level
%player_gamemode% - get the player's gamemdoe
%player_x% - get the player's x coordinate
%player_y% - get the player's y coordinate
%player_z% - get the player's z coordinate
%player_direction% - get the player's look direction
%player_exp% - get the player's cuurent experience
%player_exp_to_next% - get experience required to the player's next experience level
%player_exp_level% - get the player's experience level
%player_speed% - get the player's current speed
%player_max_air% - get the player's max air
%player_remaining_air% - get the player's remaining air
%player_item_in_hand% - get the item player hold

%server_online% - get current online players count
%server_max_players% - get max player count
%server_motd% - get the server motd
%server_ram_used% - get used memory
%server_ram_free% - get free memory
%server_ram_total% - get total memory
%server_ram_max% - get max memory
%server_cores% - get available processor cores
%server_tps% - get current TPS
%server_uptime% - get the current uptime

%time%

If you think you are good at selflearining you can look at api package on my github

1. getting API instance
Java:
//in java

PlaceholderAPI api = PlaceholderAPI.getInstance();
2. Obtaining a placeholder value
There a a few ways how to do that​
Java:
//getting single placeholder value

api.getValue(placeholderName, player); //player is optional and has an effect only for visitor sensitive placeholders



//getting placeholdered string containing X placeholders

api.translateString(inputString, player); //player is again optional for static placeholders
3. Creating a new placeholder
Also in this case you have more ways to create a new placeholder.​
There are two types of placeholders:​
a) static - don't need a player instance = are the same for everyone​
b) visitor sensitive - every player can see different value​

Java:
val api = PlaceholderAPI.getInstance()

//creating static placeholder
api.staticPlaceholder("tick", {Server.getInstance().tick}) //the simplest example

//you can also specify update interval which indicates
//how long should be value cached until it's recalculated (default is 1 second)

//PlacholderAPI has also implemented auto updater which updates the placeholder
//every period specified in update interval

//autoupdating placehodler

//this placeholder value will be refreshed every tick and automatically updated
api.staticPlaceholder("tick", {Server.getInstance().tick}, 1, true)


//creating visitor sensitive placeholder
//it's almost the same as static. The only difference is that you can use Player instance parameter in the lambda

api.visitorSensitivePlaceholder("isop", {p -> p.isOp}) //you can also use update interval and autoupdate parameters

//every placecholder can have aliases which can be contained in vararg at the end of the method

//if you want to have better control over the placeholder you can extend existing classes
//and register Placeholder instance directly like
api.registerPlaceholder(StaticPlaceHolder("test", 20, false, emptySet()) {"test"})
  • Like
Reactions: Nenyoko
Author
CreeperFace
Downloads
4,539
Views
4,696
First release
Last update
Rating
4.00 star(s) 4 ratings

More resources from CreeperFace

  • ScoreboardAPl
    ScoreboardAPl
    Simple API for fake scoreboards
  • WorldFixer
    WorldFixer
    Convert java edition worlds to bedrock easily
  • GAC
    GAC
    Cheat protection plugin originally created for GameTeam network
  • KotlinLib
    KotlinLib
    Base kotlin library for all kotlin plugins
  • Holograms
    Holograms
    Simple holograms

Latest updates

  1. Version 1.3.3

    - Fix kotlin lib
  2. Version 1.3.2

    - Fixed boolean configuration properties
  3. Version 1.3.1

    - fixed various bugs

Latest reviews

Excuse me, it's a great plugin.
hmm i like it, can i share it to Chinese Forum MCBBS? I will mark the anthor and link.
It is a mostly well done re-creation of the original clip plugin, but it is lacking in almost every way. It does not have an expansion cloud, no support for plugin developers to include their placeholders (seamless) and no way to use javascript placeholders. These are just some of the things that it is lacking.
CreeperFace
CreeperFace
Hi thanks for your review, but I don't understand what do you mean you can contact me on discord
it can't auto udating info, you can update it auto update new info in few second
I love this Plugin!!! But could you please add "%player_itemid_in_hand%? It would be perfect for a creativ server with WorldEdit! Thank you for the plugin!
Top