API Getting Started

Introduction

NameGradient contains an API

Setup

Replace VERSION with the plugin version

<dependencies>
        <dependency>
            <groupId>xshyo.us</groupId>
            <artifactId>NameGradient</artifactId>
            <version>1.4.3-STABLE</version>
            <scope>provided</scope>
        </dependency>
</dependencies>

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

depend: [NameGradient]

Getting an API instance

import xshyo.us.thegradient.NameGradientAPI;
import xshyo.us.therewards.NameGradient;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class Example extends JavaPlugin {

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

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

API


/**
 * Checks if the player is in a preview
 *
 * @param Player The Player instance of the player 
 * @return true If the player is in a preview or false if it is not
 */
 public boolean isInPreview(Player player)
 
/**
 * Checks if a player has a gradient applied in the specified type.
 *
 * @param uuid The unique ID of the player.
 * @param gradientType The type of gradient to check (CHAT or NAME).
 * @return true if the player has a gradient applied in the specified type, false otherwise.
 */
public boolean hasGradientApplied(UUID uuid, GradientType gradientType)

/**
 * Checks if a gradient with the given ID exists for the specified type.
 *
 * @param gradientType The type of gradient (CHAT or NAME) to search in.
 * @param id The ID of the gradient to check.
 * @return true if a gradient with the specified ID exists, false otherwise.
 */
public boolean existsId(GradientType gradientType, String id) 

 /**
  * Retrieves the data of a gradient by its type and ID.
  *
  * @param gradientType The type of gradient (CHAT or NAME) to retrieve data from.
  * @param id The ID of the gradient to get data for.
  * @return A map containing the gradient data, or an empty map if the gradient type is invalid.
  */

public GradientCacheData getGradientData(GradientType gradientType, String id) 

Last updated