Docs
Internal event API
Warden fires standard Bukkit events. Listen to them from any plugin without depending on Warden's internals.
Package: dev.amargos.main.warden.events
| Event | Cancellable | Carries |
|---|---|---|
WardenClanCreateEvent | No | founderId, clanName, clanTag |
WardenClanDisbandEvent | Yes | clanId, disbandedBy |
WardenMemberJoinEvent | No | playerId, clanId, roleId |
WardenMemberLeaveEvent | No | playerId, clanId |
WardenLevelUpEvent | No | clanId, previousLevel, newLevel |
WardenWarDeclaredEvent | Yes | declaringClanId, declaredClanId, warSettings |
WardenWarEndEvent | No | winnerClanId, loserClanId, duration, winnerScore, loserScore |
Cancelling
Cancelling WardenClanDisbandEvent aborts the disband and the player is told the action was cancelled. Cancelling WardenWarDeclaredEvent blocks the declaration the same way.
Notes
WardenWarEndEventcarriesnullfor both clan ids when a war ends in a draw. Guard for it.WardenClanCreateEventdoes not carry a clan id, because the clan is registered as the event fires. Resolve it throughClanService.getClanByPlayer(founderId).warSettingsis an immutable snapshot of the war rules that were in force: duration, minimum members, victory condition, score target and money reward.
Example
java
@EventHandler
public void onLevelUp(WardenLevelUpEvent event) {
if (event.getNewLevel() >= 3) {
getLogger().info("Clan " + event.getClanId() + " reached level " + event.getNewLevel());
}
}Reading clan data
The plugin instance exposes every service through getters: getClanService(), getBankService(), getWarService(), getProgressionService(), getStatsService(), getRelationService(), getLeaderboardService(), getUpgradeService() and getIntegrationManager().
java
Warden warden = (Warden) Bukkit.getPluginManager().getPlugin("Warden");
Clan clan = warden.getClanService().getClanByPlayer(player.getUniqueId());Treat everything returned as read-only. Mutating a Clan directly bypasses persistence; go through the services instead.