BanHammer 4.2: code audit, offline punishments and one jar for 1.21 and 26.x
BanHammer is my moderation plugin for Paper and Folia servers: ban, mute, warn and jail players with presets, a punishment history in the database and Discord integration. After version 4.0 I reviewed the entire code base. Version 4.1.0 adds no features for their own sake – it makes the existing ones behave exactly as documented.
New in 4.2
- Punishments for players who are offline but have been on the server before – ban, mute, jail and warn. A jail takes effect on the next login.
- Jail time only counts down while the player is online.
- New command /bh ban <player> [duration] [reason].
- Approving an appeal now actually lifts the appealed punishment – mutes and jails included.
- Expiring temporary bans no longer remove other bans of the same player, and the hammer works fully without a database.
Security (4.1)
- Player input such as appeal texts is now escaped. Previously it could be used to inject clickable commands into staff chat and hidden links into the Discord channel.
- The statistics menu checks permissions on every access instead of recognising it by its window title.
- banhammer.bypass and banhammer.ipban are now respected by every command.
- Discord webhook URLs no longer end up in the log.
Punishments that do what they should
- An unrecognised duration used to silently create a permanent punishment. Now it produces an error, and weeks, months and years are supported.
- Automatic bans after warnings no longer fire again and again; warnings can expire.
- Expired punishments are lifted reliably on Folia too.
- Jailed players can no longer escape by logging in again.
Database
Punishments are stored in SQLite or MySQL. With 4.1 MySQL works reliably, existing tables are migrated automatically on updates, and the longer names of Bedrock players via Geyser fit as well. If the database goes down, staff get an error message instead of records being lost silently.
Discord as a second pair of eyes
Every moderation action can be mirrored into a Discord channel, so the team sees what's happening on the server even when they're not in-game.
Compatibility
BanHammer 4.2.0 is a single jar again for Paper and Folia from Minecraft 1.21.1 to 26.x and requires Java 21.
The goal stays the same: on a serious server, moderation shouldn't be a gut feeling – it should be documented and traceable.