Setting up own playtime calculator
The Custom Playtime Calculator Registration API allows you to integrate your own playtime calculation logic into the UltimateReward plugin.
Usage
Implement Your Playtime Calculator
To create a custom playtime calculator, inherit from the
PlayTimeCalculator
interface and implement thecalculatePlayTime(Player player)
method. This method should contain your custom logic to calculate the playtime of the given player.Register Your Calculator
After implementing your custom playtime calculator, register it with the UltimateReward plugin using the
registerPlayTimeCalculator()
method. This ensures that your custom logic is integrated into the playtime tracking system.
Method must return the play-time in minutes
Example
Here's a practical example demonstrating how to register a custom playtime calculator:
In this example, MyOwnPlayTimeCalculator
calculates playtime based on Minecraft's built-in statistics, converting total playtime from ticks to minutes.
Last updated