The ZelDuels API lets other plugins read duel state and react to duels through Bukkit events. It is a read-only / event-based API: you can query arenas, requests and player stats, and you can veto a duel before it starts, but you cannot mutate internal state.
Everything public lives in the com.zeltuv.zelduels.api package (and its data / events
sub-packages), which is excluded from obfuscation — symbol names are stable across releases.
<repository>
<id>repsy.io</id>
<url><https://repo.repsy.io/mvn/zeltuv/zelduels></url>
</repository>
<dependency>
<groupId>com.zeltuv</groupId>
<artifactId>zelduels-api</artifactId>
<version>3.3.4</version>
<scope>provided</scope>
</dependency>
repositories {
mavenCentral()
maven { url '<https://repo.repsy.io/mvn/zeltuv/zelduels>' }
}
dependencies {
compileOnly 'com.zeltuv:zelduels-api:3.3.4'
}
Add ZelDuels to your plugin's softdepend in plugin.yml so it loads first.
ZelDuels exposes a single interface, ZelDuelsAPI, registered with Bukkit's ServicesManager and
reachable through the static helper ZelDuels. Both live in the com.zeltuv.zelduels.api package.
import com.zeltuv.zelduels.api.ZelDuels;
import com.zeltuv.zelduels.api.ZelDuelsAPI;
ZelDuelsAPI api = ZelDuels.getApi();
if (api == null) {
// ZelDuels isn't enabled yet — bail out or retry later.
return;
}
ZelDuels.getApi() returns null until ZelDuels has finished enabling and registered itself, so
gate your initial calls on onEnable after the plugin loader has run (a softdepend guarantees
this ordering).
ZelDuelsAPI interfaceThe entry point to everything else.
import com.zeltuv.zelduels.api.manager.IDuelManager;
import com.zeltuv.zelduels.api.data.IDuelStats;
import java.util.Optional;
IDuelManager duels = api.getDuelManager();
// Persistent stats for a player currently loaded in memory (online / recently active).
Optional<IDuelStats> stats = api.getStats(player.getUniqueId());
stats.ifPresent(s -> {
int wins = s.getWins();
int losses = s.getLosses();
int streak = s.getWinstreak();
});
getStats(...)reflects in-memory data for online (or recently loaded) players. It returns an emptyOptionalfor players who were never loaded this session.