Addon Development

⚙️ TreexClans Addon Development

Welcome to the TreexClans Addon Development Guide. Here you’ll learn how to create your own addon, connect it to the API, set up dependencies, and correctly build your .jar file.

🧠 This page is intended for developers. If you just want to learn what addons are, see the Addons Overview page.


📦 Connecting the TreexClans API

To use the TreexClans API in your project, add the repository and dependency to your build system.

triangle-exclamation
circle-exclamation
repositories {
    maven {
        name = "jetby-repo"
        url = "https://maven.jetby.space"
    }
    maven {
        name = "jitpack.io"
        url = "https://jitpack.io"
    }
    maven {
        name = "Jodexindustries-releases"
        url = "https://repo.jodex.xyz/releases"
    }
}

dependencies {
    compileOnly("space.jetby.TreexClans:api:2.1")
}

🧱 Project Structure

At minimum, an addon must include:

  • a main class that extends JavaAddon;

  • a @ClanAddon annotation with basic metadata;

  • a valid plugin.yml (if required);

  • any resources or configuration files (if needed).

Example project structure:


🧩 Basic Addon Example

🔑 Key Points

  • @ClanAddon — required for the addon to be recognized and registered.

  • id must be unique among all addons.

  • extends JavaAddon — defines the entry point of your addon.

  • onEnable() and onDisable() — control the addon’s lifecycle.



🧭 Working with the API and Services

TreexClans provides a Service Manager, which can be accessed through the addon’s context:

Основные методы:

Пример — получить клан игрока:


🧰 Commands and Interfaces

Adding a subcommand:



🎨 GUI and Menus

The GUI system allows you to create custom menus for player interaction.

Registering a GUI type:

Example GUI class:


🧩 Addon Configuration

TreexClans creates a separate directory for each addon:

Example of getting the configuration:


🏗️ Building and Installation

  1. Build your project into a .jar file (using Gradle or Maven).

  2. Place the file into plugins/TreexClans/addons/.

  3. Restart the server or use /xclan reload

The console will display a message:



💡 Recommendations

  • Do not embed the TreexClans API inside your .jar.

  • Always check for the @ClanAddon annotation and correct inheritance.

  • Use getLogger() for logging instead of System.out.

  • Store configuration and data files inside the addon’s dedicated folder.

  • Follow consistent naming and versioning conventions.


📘 Summary

Now you know how to:

  • connect to the TreexClans API;

  • create and register your own addon;

  • work with services, GUIs, and commands;

  • build and install your module on the server.

🔗 Next step — explore the advanced features of the API: events, dependencies, caching, and database integration.

Last updated