Skip to main content

API Reference

RocketPlaceholders provides a comprehensive API for developers to integrate custom placeholders into their plugins.

Overview

The RocketPlaceholders API allows you to:
  • Add placeholders programmatically
  • Retrieve existing placeholders
  • Integrate with other plugins
  • Create dynamic placeholder systems

Adding the Plugin as a Dependency

Replace VERSION with the latest version. Check the releases page for the current version.

Getting the API

Get the RocketPlaceholders API instance using Bukkit’s ServicesManager:
Always check if the API is null before using it. RocketPlaceholders might not be installed or enabled.

Adding Placeholders

Without Permission Nodes

Create a simple placeholder without permission requirements:
Example:
This creates a placeholder %rp_welcome% that displays “Welcome to our server!”.

With Permission Nodes

Create a placeholder that shows different text based on permissions:
Example:
How it works:
  • Players without server.vip permission see: “Regular Player”
  • Players with server.vip permission see: “VIP Member”

Retrieving Placeholders

Internal Placeholders

Get all internal placeholders (placeholders defined in config files):

External Placeholders

Get all external placeholders (placeholders added via API):

Important Notes

Placeholders added via API won’t be synchronized with MySQL. They are stored locally on each server.
If you’re using MySQL synchronization:
  • API placeholders are local to each server
  • They won’t sync across your network
  • Consider using the configuration files for placeholders that need to sync

API Cookbook

For more examples and advanced usage, check out the RocketPlaceholders API Cookbook. The cookbook includes:
  • Advanced placeholder creation examples
  • Integration patterns
  • Best practices
  • Common use cases

Javadocs

For complete API documentation, see the RocketPlaceholders Javadocs.
The Javadocs include:
  • Complete class references
  • Method documentation
  • Parameter descriptions
  • Return type information

Example Integration

Here’s a complete example of integrating RocketPlaceholders into your plugin:

Best Practices

  1. Check for API availability - Always verify the API is available before using it
  2. Handle errors gracefully - Wrap API calls in try-catch blocks if needed
  3. Use descriptive identifiers - Choose clear placeholder names (e.g., myplugin_status instead of status)
  4. Document your placeholders - Let users know what placeholders your plugin provides
  5. Consider MySQL sync - If you need placeholders to sync across servers, use config files instead of the API

Support

Need help with the API? Join our Discord server for developer support!