EternalTD Developer API
Generated Java reference includes searchable classes, methods and signatures, with the source version and commit recorded for each module.
EternalTD exposes custom Bukkit events under com.magmaguy.eternaltd.api that other plugins can listen to for integration.
Tower Events
These events fire when a player interacts with towers during a level session.
| Event | Cancellable | Exposed data |
|---|---|---|
TowerPlaceEvent | Yes | Tower tower |
TowerSellEvent | Yes | Tower tower |
TowerUpgradeEvent | Yes | Tower tower |
Cancelling a tower event prevents the action from completing.
TowerPlaceEvent runs after the tower's grid square has been assigned, but before its living entity is spawned, its cost is charged or it is added to the session's tower set. Do not assume getLivingEntity() is available in that callback. Upgrade and sell events run before the corresponding currency change and tower mutation.
Wave Phase Events
These events fire during wave lifecycle transitions. None of them are cancellable.
| Event | Exposed data |
|---|---|
WaveConstructionPhaseStartEvent | LevelSession levelSession |
WaveStartingPhaseStartEvent | LevelSession levelSession |
WaveDefensivePhaseEvent | LevelSession levelSession |
WaveEndingPhaseEvent | LevelSession levelSession |
WaveStartingPhaseStartEvent fires when the session enters its initial waiting-for-start state. WaveConstructionPhaseStartEvent fires between waves. WaveDefensivePhaseEvent is dispatched before the session increments to the next wave number, so reading the number during that callback returns the preceding value. Despite its name, WaveEndingPhaseEvent fires when the session ends, not after every completed wave.
During the starting event, the session is already in LevelSession.getSessions() but not yet marked playable, and the player is still outside the level world without the match items; the entry teleport happens on the next tick. During the ending event, the current wave has been shut down and any new high score recorded, while the session is still registered and its towers, the player's own state and the instance world have not yet been cleaned up. When the run ends because the player disconnected, the player has already left: their state is restored and the session is no longer in LevelSession.getSessions().
Wave Entity Events
These events fire when wave entities take damage or die.
| Event | Cancellable | Exposed data |
|---|---|---|
WaveEntityDamageEvent | No | Tower tower, WaveEntity waveEntity, boolean directDamage |
WaveEntityDeathEvent | No | WaveEntity waveEntity |
WaveEntityDamageEvent is a notification, not a damage-editing hook: it has no amount setter. An AOE direct hit emits it to trigger splash processing without applying a separate direct hit. For ordinary damage, nonlethal hits emit the damage event after health changes; lethal hits emit WaveEntityDeathEvent instead, after the entity has been removed. Fully armor-absorbed direct damage emits neither immediately; separately scheduled damage over time can emit later events.
Usage Example
import com.magmaguy.eternaltd.api.TowerPlaceEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class MyETDIntegration implements Listener {
@EventHandler
public void onTowerPlace(TowerPlaceEvent event) {
// React to tower placement
}
}
Notes
- All events are standard synchronous Bukkit events.
TowerandWaveEntityare EternalTD internal types. Use their public getters for data access.LevelSessionexposes the wave number, towers and config through getters. Access its player throughgetMatchPlayer().getPlayer().LevelSessionextends MagmaCore'sMatchclass. EternalTD shades MagmaCore undercom.magmaguy.eternaltd.magmacore, so in the plugin jar that class iscom.magmaguy.eternaltd.magmacore.match.Match.