Skip to content
jojoe77777 edited this page Oct 13, 2015 · 22 revisions

Placeholders

What is Placeholders? Placeholders is a plugin designed to help plugin developers and server owners, by taking the trouble out of coding placeholders. Placeholders currently has over 70 pre-coded placeholders, but if that's not enough for you, you can add your own, by adding code to the placeholders.php file!

Notes:
The placeholders are case-insensitive.
$gvars contains global placeholders (like server info, and top kills)
$svars contains personal placeholders (like IP, name, and money)

// Example placeholders

$svars["{example_placeholder}"] = "Example!";

// You can make a placeholder out of normal text if you want
// This will replace "this is just text" with "Another example!"

$gvars["this is just text"] = "Another example!"

API usage example from another plugin

$manager = $this->getServer()->getPluginManager();
$msg = "Your ip is {ip}";
if(($placeholders = $manager->getPlugin("Placeholders")) !== null){
$msg = $placeholders->Placeholders($msg, $player);
/* Output: "Your ip is 192.168.0.18" (Player's IP) */
}

Clone this wiki locally