RankAPIv3
RankAPIv3 is an advanced API for managing player ranks in a Minecraft server. It includes features such as dynamic rank management, temporary ranks, playtime-based promotions, rank persistence, and integration with both configuration files and databases.
This API is designed for flexibility, allowing extensive customization for ranks and efficient management of rank-based features.
Key Features
Dynamic Rank Management
Add, remove, and retrieve ranks dynamically.
Store ranks in both configuration files and databases.
Temporary Ranks
Assign ranks for a limited time.
Automatically remove expired temporary ranks.
Playtime-Based Promotions
Promote players based on their total playtime.
Customize playtime requirements for each rank.
Rank Persistence
Store player ranks per world in the database.
Retrieve ranks seamlessly for players across server restarts.
Economy Integration
Apply rank-based multipliers for economy payouts.
Chat Customization
Define rank-specific prefixes, suffixes, and chat colors.
Initialization
Singleton Pattern
RankAPIv3 uses a private constructor to enforce a singleton pattern:
To initialize and access RankAPIv3:
Rank Structure
Rank Class
Each rank is represented by the Rank class with the following attributes:
Name: The rank identifier.
Permission: Permission string required for the rank.
Prefix: Chat prefix.
Suffix: Chat suffix.
Chat Color: Default chat color.
Priority: Determines rank hierarchy.
Playtime Required: Minimum playtime required for promotion to the rank.
Economy Multiplier: Multiplier applied for economy-based rewards.
Taxes Due: Tax deadlines for the rank.
Taxes Amount: Tax amounts for the rank.
Example
Public Methods
Rank Management
Add or Retrieve Ranks
Add new rank:
Get all ranks:
Temporary Ranks
Assign a temporary rank:
Remove a temporary rank:
Check for expired ranks:
Playtime Management
Add and Get Playtime
Add playtime:
Retrieve playtime:
Promote by Playtime
Promote a player based on their playtime:
Rank Persistence
Player Rank Management
Assign rank to a player:
Save rank to a specific world:
Retrieve rank from a specific world:
Delete Player Rank
Economy Integration
Get Economy Multiplier
Retrieve the economy multiplier for a rank:
Apply Rank-Based Payout
Chat Customization
Get Chat Settings
Prefix:
Suffix:
Chat Color:
AFK Prefix
Configuration Example
Ranks Configuration
Error Handling
Missing Rank
Logs a warning if a rank is missing during initialization:
Database Errors
Logs SQL exceptions during database operations:
Advanced Usage
Promotions with Custom Criteria
Use Criteria to define custom promotion conditions:
Best Practices
Database and Configuration Sync:
Use both
saveRankToDatabaseandsaveRankToConfigto ensure consistency.
Temporary Ranks:
Regularly invoke
checkTemporaryRanks()to clean up expired ranks.
Playtime Promotions:
Set realistic playtime thresholds to encourage player progression.
Logging:
Monitor server logs for potential issues with missing ranks or configuration errors.
Last updated