13 API tutorial
Daniel Saukel edited this page 2021-11-02 03:21:16 +01:00

DungeonsXL has, as of v0.18, an API module that will allow for programming stable hooks.


  1. How to get the API
  2. Hooking into DXL

How to get the API

The DungeonsXL API can be built from source or downloaded from the Maven repository.

    <dependencies>
        <dependency>
            <groupId>de.erethon.dungeonsxl</groupId>
            <artifactId>dungeonsxl-api</artifactId>
            <version>0.18-PRE-02</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <repositories>
        <repository>
            <id>dre-repo</id>
            <url>https://erethon.de/repo</url>
        </repository>
    </repositories>

Alternatively, binaries can be downloaded manually here.

Hooking into DXL

The main class of the API is the DungeonsAPI singleton.

DungeonsAPI dxl;

@Override
public void onEnable() {
    if (!Bukkit.getPluginManager().isPluginEnabled("DungeonsXL")) return;
    dxl = (DungeonsAPI) Bukkit.getPluginManager().getPlugin("DungeonsXL");
}