Skip to content

xShyo/TheRewards-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🎁 TheRewards API

This API allows developers to create custom rewards, playtime systems, daily streaks, and integrate external addons.


✨ Main Features

  • 🔒 Full system for custom rewards.
  • ⏱️ Playtime-based rewards (PlayTime).
  • 📅 Daily streak rewards (Streak).
  • 🔌 Public API for external addons.

📦 Installation

Add the TheRewards .jar file to your plugins/ folder.

If you're a developer and want to use this API in your plugin:

Using Maven

<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>

Using Gradle

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
}

dependencies {
    compileOnly 'us.xshyo:therewards-api:1.0.0'
}

🔧 How to Use

Get the rewards manager

RewardsManager manager = TheRewardsAPI.getInstance().getRewardsManager();

Accessing rewards

Rewards reward = manager.getRewardsHashMap().get("reward_name");
if (reward != null) {
    player.sendMessage("You can claim the reward: " + reward.getName());
}

🧩 Public API - TheRewardsAPI

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.

🛠️ Commands

The JRCommand class allows registering custom commands connected to the reward logic. You can extend it to register your own commands within your plugin.


📚 Key Classes

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.

About

Public API for TheRewards

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages