HomeJavaModsTownyAlerts
TownyAlerts
ModsJava

TownyAlerts

Towny event alerts and Discord notifications for modern Paper and Purpur servers.

⬇ Download on Spigot
TownyAlerts is a lightweight and configurable Towny notification plugin designed to keep server administrators informed about important Towny events directly through Discord.

Receive automatic alerts for Towny New Day processing, bankrupt towns, ruined towns, fallen towns and nations while reusing your existing DiscordSRV bot connection.

Unlike plugins that modify Towny's economy or daily processing, TownyAlerts works only as an observational layer. It does not change taxes, upkeep, balances, towns, nations, residents or Towny's New Day system.

Features

✔ Towny New Day summaries
✔ Town bankruptcy alerts
✔ Town ruin alerts
✔ Fallen town and nation notifications
✔ Missed New Day detection
✔ DiscordSRV integration
✔ No additional Discord bot required
✔ No Discord webhook required
✔ Configurable Discord channels per alert type
✔ Multi-language support
✔ Custom community language packs
✔ Memory / SQLite / MariaDB / MySQL storage
✔ Persistent event history and deduplication
✔ Asynchronous Discord and database processing
✔ Configurable startup banner
✔ Failure isolation from Towny
✔ No telemetry
✔ No external update checker
✔ Java 17 baseline
✔ Designed for modern Towny versions

Towny Alerts

TownyAlerts listens directly to official Towny events.

Supported alert types include:
• Towny New Day
• Town bankruptcy
• Town ruins
• Fallen towns
• Fallen nations
• Missed New Day notifications

TownyAlerts does not attempt to reproduce or modify Towny's economy calculations.

Whenever possible, information comes directly from Towny's official events and public APIs.

New Day Summary
After Towny completes its daily processing, TownyAlerts can send a Discord summary containing information such as:

• Town upkeep collected
• Nation upkeep collected
• Bankrupt towns
• Fallen towns
• Fallen nations
• New Day timestamp

The values are obtained from Towny's official New Day event.

TownyAlerts does not independently calculate or modify these values.

Bankruptcy Alerts

When a town enters bankruptcy, TownyAlerts can immediately notify administrators through Discord.

Depending on the information available through Towny's API, the alert can include:
• Town name
• Mayor
• Nation
• Bank balance
• Resident count
• Timestamp

Towny itself remains the source of truth for bankruptcy detection.

Ruined Town Alerts

TownyAlerts can notify administrators when a town enters ruins.

Alerts may include:
• Town name
• Previous mayor
• Nation
• Resident count
• Timestamp

Missed New Day Detection

TownyAlerts includes an optional recovery system for situations where the plugin or server starts after the expected Towny New Day time.

TownyAlerts safely distinguishes between a scheduled New Day time that has passed and a New Day that can actually be confirmed.

It never:
• Executes Towny New Day
• Charges taxes
• Charges upkeep
• Changes balances
• Runs Towny administrative commands
• Invents historical economy data

Discord Integration
TownyAlerts uses your existing DiscordSRV connection.

You do not need:
• A second Discord bot
• A TownyAlerts bot token
• A Discord webhook
• An external Discord API service

Communication flow:
Towny Event → TownyAlerts → DiscordSRV / JDA → Discord Channel

You can configure one default Discord channel or separate channels for:
• New Day alerts
• Bankruptcy alerts
• Ruin alerts

Language System
TownyAlerts includes a dynamic language system.

Included languages:
• en-us — American English
• es-cl — Latin American Spanish

Built-in aliases:
en → en-us
es → es-cl

Language identifiers are case-insensitive.

Custom language files can be added to:
plugins/TownyAlerts/languages/

Examples:
fr.yml
fr-ca.yml
es-mx.yml
en-uk.yml
de.yml
pt-br.yml

No recompiling is required.

Missing translation keys automatically fall back to en-us.

Storage Support
TownyAlerts does not require a database.

The default storage mode is Memory.

Supported storage types:
• Memory
• SQLite
• MariaDB
• MySQL

Persistent storage can provide:
• Event history
• Persistent event deduplication
• Missed New Day deduplication
• Multi-server storage

Memory Storage
Memory is the default and simplest option.

It requires:
• No database
• No database server
• No database file
• No additional configuration

Deduplication data is kept only while the server process is running.

SQLite Storage
SQLite provides local persistent storage without requiring an external database server.

The database is stored inside:

plugins/TownyAlerts/

SQLite paths are restricted to the plugin directory for additional safety.

MariaDB / MySQL Storage
TownyAlerts can connect to an administrator-managed MariaDB or MySQL database.

TownyAlerts does not automatically create:

• Databases
• Database users
• Database permissions

It only manages its own required tables when automatic table creation is enabled.

Database passwords can optionally be provided through environment variables.

Sensitive credentials are never displayed in status output.

Multi-Server Storage
Multiple Towny servers can share the same MariaDB or MySQL database by using a different server ID for each server.

This keeps event history and deduplication separated between servers.

Commands

/townyalerts status
Shows TownyAlerts, Towny, DiscordSRV, language and storage status.

/townyalerts test
Sends a test notification to Discord.

/townyalerts reload
Reloads TownyAlerts configuration and language files.

/townyalerts storage status
Shows the current storage backend status.

/townyalerts storage test
Tests the configured storage connection.

Permissions

townyalerts.admin
Default: OP

Provides access to all TownyAlerts administrative commands.

Performance
TownyAlerts is designed to remain isolated from Towny's core processing.

The plugin includes:
• Asynchronous Discord delivery
• Asynchronous database operations
• Bounded database processing
• Persistent deduplication
• Bounded Discord initialization retries
• Limited log inspection
• Failure isolation

Database or Discord failures do not cancel or modify Towny events.

Security
TownyAlerts does not require or contain:

• Discord bot tokens
• Discord webhooks
• Telemetry
• External analytics
• Automatic external update checks
• Arbitrary JDBC URLs

Additional protections include:
• Prepared SQL statements
• Validated database configuration
• Protected SQLite paths
• Discord mention protection
• Language path traversal protection
• Credential-safe status output

Requirements:
• Towny
• DiscordSRV
• Java 17 or newer depending on your Minecraft server version
• Paper or Purpur

No external database is required unless persistent storage is enabled.

Installation
  1. Download TownyAlerts.
  2. Place the JAR inside your plugins folder.
  3. Make sure Towny and DiscordSRV are installed.
  4. Start the server.
  5. Open plugins/TownyAlerts/config.yml.
  6. Configure your Discord channel.
  7. Restart the server or reload TownyAlerts.
  8. Run /townyalerts test.
Documentation
Wiki: https://github.com/Karuho/townyalerts/wiki


Support
For support, bug reports, suggestions, and beta testing, join the DynaDev community.

Discord: https://discord.gg/YHNqJfGTdN

https://discord.gg/YHNqJfGTdN

❤️ Support DynaDev
DynaDev projects are developed and maintained for the Minecraft community.

If you enjoy using our plugins and would like to support future development, any contribution is greatly appreciated.

Your support helps fund:

• Future plugin development
• New features
• Bug fixes
• Compatibility updates
• Testing infrastructure
• Documentation
• Community tools
• New DynaDev projects

Support links:
• Ko-fi: https://ko-fi.com/karuho
• PayPal: https://www.paypal.com/paypalme/dynadev
• GitHub Sponsors: https://github.com/sponsors/Karuho

Thank you for supporting NexusBeacon and helping the project grow!

TownyAlerts is a free Minecraft Java mod. Compatible with Minecraft 1.19, 1.20, 1.20.6, 1.21 and newer. Downloaded 6 times (via Spigot). Download it and open it directly in the game.

Explore more