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:Adding Placeholders
Without Permission Nodes
Create a simple placeholder without permission requirements:%rp_welcome% that displays “Welcome to our server!”.
With Permission Nodes
Create a placeholder that shows different text based on permissions:- Players without
server.vippermission see: “Regular Player” - Players with
server.vippermission 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.
- 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.
- 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
- Check for API availability - Always verify the API is available before using it
- Handle errors gracefully - Wrap API calls in try-catch blocks if needed
-
Use descriptive identifiers - Choose clear placeholder names (e.g.,
myplugin_statusinstead ofstatus) - Document your placeholders - Let users know what placeholders your plugin provides
- Consider MySQL sync - If you need placeholders to sync across servers, use config files instead of the API
Related Resources
- API Cookbook - Examples and patterns
- Javadocs - Complete API documentation
- GitHub Repository - Source code and issues