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

EventCancellableCarries
WardenClanCreateEventNofounderId, clanName, clanTag
WardenClanDisbandEventYesclanId, disbandedBy
WardenMemberJoinEventNoplayerId, clanId, roleId
WardenMemberLeaveEventNoplayerId, clanId
WardenLevelUpEventNoclanId, previousLevel, newLevel
WardenWarDeclaredEventYesdeclaringClanId, declaredClanId, warSettings
WardenWarEndEventNowinnerClanId, 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

  • WardenWarEndEvent carries null for both clan ids when a war ends in a draw. Guard for it.
  • WardenClanCreateEvent does not carry a clan id, because the clan is registered as the event fires. Resolve it through ClanService.getClanByPlayer(founderId).
  • warSettings is 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.

Internal event API | Warden Docs