-
Notifications
You must be signed in to change notification settings - Fork 0
Documentation for developers
SpGerg edited this page Aug 27, 2023
·
12 revisions
You need import:
PlaceholdersAPI
You can find it in releases.
Placeholder class example:
public class CoolPlaceholder : IPlaceholder
{
public string Name => "Cool placeholder";
public string Identifier => "cool";
public string Author => "SpGerg";
public string Description => "Just cool placeholder, lol.";
public string OnPlaceholderRequest(Player player, string identifier)
{
if (identifier == "placeholder")
{
return "Coolest placeholder in the world.";
}
else if (identifier == "placeholder2")
{
return "Coolest placeholder again?";
}
return null;
}
}Placeholder example:
cool_placeholder
just-good_placeholder
identifier_placeholder
(DONT use _ in identifier)
After making placeholder class you need register this:
public override void OnEnabled()
{
PLAPI.Register(new CoolPlaceholder());
base.OnEnabled();
}After creating a placeholder, you can use it like this (It is other project):
public static void OnPlayerJump(JumpingEventArgs ev)
{
ev.Player.Broadcast(2, PLAPI.SetPlaceholders(ev.Player, "Placeholder: {cool_placeholder}"));
Timing.CallDelayed(3f, () =>
{
ev.Player.Broadcast(2, PLAPI.SetPlaceholders(ev.Player, "Placeholder: {just-good_placeholder2}"));
});
}
