This API allows developers to create custom rewards, playtime systems, daily streaks, and integrate external addons.
- 🔒 Full system for custom rewards.
- ⏱️ Playtime-based rewards (
PlayTime). - 📅 Daily streak rewards (
Streak). - 🔌 Public API for external addons.
Add the TheRewards .jar file to your plugins/ folder.
If you're a developer and want to use this API in your plugin:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>us.xshyo</groupId>
<artifactId>therewards-api</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
dependencies {
compileOnly 'us.xshyo:therewards-api:1.0.0'
}RewardsManager manager = TheRewardsAPI.getInstance().getRewardsManager();Rewards reward = manager.getRewardsHashMap().get("reward_name");
if (reward != null) {
player.sendMessage("You can claim the reward: " + reward.getName());
}You can use this class to query rewards directly or check if a player can claim a streak reward.
TheRewardsAPI api = new TheRewardsAPI();
Rewards reward = api.getRewardByName("daily");
if (reward != null) {
player.sendMessage("You have a daily reward available!");
}
if (api.isReward("vip_weekly")) {
Bukkit.getLogger().info("The reward vip_weekly exists.");
}
if (api.availableStreak(player.getUniqueId())) {
player.sendMessage("Your streak reward is available!");
}Available methods:
| Method | Description |
|---|---|
getRewardByName(String) |
Returns a reward by its name. |
isReward(String) |
Checks if a reward with that name exists. |
availableStreak(UUID) |
Checks if a player can claim their streak reward. |
The JRCommand class allows registering custom commands connected to the reward logic. You can extend it to register your own commands within your plugin.
| Class | Description |
|---|---|
RewardsManager |
Manages rewards, playtime, and streaks. |
Rewards |
Defines a reward with actions, permissions, and requirements. |
PlayTime |
Represents rewards based on minutes played. |
Streak |
Defines rewards for logging in on consecutive days. |
Database |
Abstract class for handling data storage. |
PlayerRewardData |
Stores individual player reward data. |
TheRewardsAPI |
Provides quick access to rewards and streak-checking methods. |