API Getting Started

Introduction

TheRewards contains an API for obtaining or modifying player rewards.

Setup

Replace VERSION with the plugin version

<dependencies>
        <dependency>
            <groupId>xshyo.us</groupId>
            <artifactId>TheRewards</artifactId>
            <version>1.4.5-STABLE</version>
            <scope>provided</scope>
        </dependency>
</dependencies>

In your plugin.yml file you must add as a dependency

depend: [TheRewards]

Getting an API instance

import xshyo.com.therewards.TheRewardsAPI;
import xshyo.com.therewards.TheRewards;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class Example extends JavaPlugin {

    private TheRewardsAPI api;    
        
    @Override
    public void onEnable() {
        if (Bukkit.getPluginManager().isPluginEnabled("TheRewards")) {
            this.api = TheRewards.getInstance().getAPI();
        }

        if (this.api != null) {
    
        }
        
    }
}

API

The Settings option is not yet functional.

/**
 * Retrieves a reward by its name.
 *
 * @param name Name of the reward to search for.
 * @return The reward corresponding to the provided name, or null if not found.
 */
 
public Rewards getRewardByName(String name)

/**
 * Checks if a reward exists by its name.
 *
 * @param name Name of the reward to check.
 * @return true if the reward exists, false otherwise.
 */
public boolean isReward(String name)


public boolean availableStreak(UUID uuid)

/**
 * Sets reward options for a player.
 *
 * @param playerId Unique identifier of the player.
 * @param settingsData Reward configuration data for the player.
 */
public void setRewardOptions(UUID playerId, SettingsData settingsData)


/**
 * Retrieves reward options for a player.
 *
 * @param playerId Unique identifier of the player.
 * @return Reward configuration data for the player identified by their UUID.
 */
public SettingsData getRewardOptions(UUID playerId)

Last updated