GangsX
  • GangsX
  • Overview
    • Features
    • Commands & Permissions
    • Placeholders
    • Changelogs
      • v1.3
      • v1.2
      • v1.1
  • Product Guides
    • Configuring The Plugin
  • Previews
    • config.yml
    • quests.yml
    • tournament.yml
    • locale.yml
  • API Usage
    • Developer API
    • Events
      • GangCreateEvent
      • GangDisbandEvent
      • GangPermissionUpdateEvent
      • GangShopPurchaseEvent
      • PlayerJoinGangEvent
      • PlayerLeaveGangEvent
Powered by GitBook
On this page
  • Maven Integration
  • Hooking into GangsX
  • Getting the APIManager instance
  1. API Usage

Developer API

Plugin API Usage

Maven Integration

There is no maven repository for this plugin, You can add it directly to your project using a filepath like the following:

        <dependency>
            <groupId>me.frxq</groupId>
            <artifactId>gangsx</artifactId>
            <version>LATEST</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/libs/GangsX.jar</systemPath>
        </dependency>


Hooking into GangsX

Firstly check the plugin is enabled using the following:

    public boolean isGangsXEnabled() {
        if(Bukkit.getPluginManager().getPlugin("GangsX") == null) {
           return false;
        }
        return true;
    }

Getting the APIManager instance

Use this code to get all of the features from GangsX API

APIManager apiManager = GangsX.getAPI();

This will return the APIManager class which contains the following methods:

public class APIManager {
    private final GangsX plugin;

    public APIManager(GangsX plugin) {
        this.plugin = plugin;
    }
    /**
     * Retrieves the Gang object associated with the given player UUID.
     *
     * @param  playerUUID  the UUID of the player for whom to retrieve the Gang
     * @return             the Gang object associated with the player UUID, or null if the player does not have a gang
     */
    public Gang getGang(UUID playerUUID) {
        GPlayer gPlayer = plugin.getGPlayerDataFactory().getGPlayerData(playerUUID);
        if(!gPlayer.hasGang()) {
            return null;
        }
        return plugin.getGangDataFactory().getGangData(gPlayer.getGangId());
    }
    /**
     * Retrieves the GPlayer object associated with the given player UUID.
     *
     * @param  playerUUID  the UUID of the player for whom to retrieve the GPlayer
     * @return             the GPlayer object associated with the player UUID, or null if the player does not exist
     */
    public GPlayer getGPlayer(UUID playerUUID) {
        return plugin.getGPlayerDataFactory().getGPlayerData(playerUUID);
    }
    /**
     * Retrieves the Tournament object from the plugin.
     *
     * @return the Tournament object from the plugin
     */
    public Tournament getTournament() {
        return plugin.getTournament();
    }
    /**
     * Returns the QuestUtils object associated with the plugin.
     *
     * @return the QuestUtils object
     */
    public QuestUtils getQuestUtils() {
        return plugin.getQuestUtils();
    }
}

Previouslocale.ymlNextEvents

Last updated 6 months ago