Skip to content

Alerts and Events

DynaDev edited this page Aug 12, 2026 · 1 revision

Alerts and Towny Events

TownyAlerts listens to official Towny events.

The plugin is an observer. It does not cancel or modify the events it receives.

New Day summary

Primary Towny event:

NewDayEvent

This event occurs after Towny's New Day processing.

TownyAlerts uses the official event data for:

  • Total town upkeep collected
  • Total nation upkeep collected
  • Bankrupted towns
  • Fallen towns
  • Fallen nations
  • New Day timing information exposed by the event

TownyAlerts does not recalculate these totals independently.

A typical summary contains sections such as:

Town upkeep
Nation upkeep
Bankrupt towns
Fallen towns
Fallen nations

If the lists are empty, the language pack can display a localized None/Ninguna value.

Town bankruptcy

Primary Towny event:

TownEntersBankruptcyEvent

TownyAlerts can send an immediate bankruptcy alert.

Depending on information safely available from Towny's public API, the alert may include:

  • Town name
  • Mayor
  • Nation
  • Bank balance
  • Resident count
  • Timestamp

TownyAlerts does not determine bankruptcy using its own formula.

Towny remains the source of truth.

Town ruins

Primary Towny event:

TownRuinedEvent

The alert can include:

  • Town name
  • Previous mayor
  • Nation, when still safely available
  • Resident count
  • Timestamp

Fallen nations

TownyAlerts does not invent a NationEntersBankruptcyEvent.

Fallen nations from daily processing are reported using the official data exposed by NewDayEvent.

Pre-New Day alerts

Pre-processing notifications can optionally be enabled.

They represent only that Towny is starting or preparing the New Day cycle.

A pre-event is never treated as proof that a tax/upkeep payment succeeded.

Threading

Towny events may occur outside the primary server thread.

TownyAlerts captures the required event data and performs Discord/storage work asynchronously where appropriate.

It avoids blocking Discord operations such as synchronous JDA completion calls.

Deduplication

TownyAlerts prevents accidental duplicate alerts.

Persistent backends can preserve deduplication information across server restarts.

MEMORY mode only preserves it for the life of the current server process.

Clone this wiki locally