Mirrors your Paper server console log to a Discord channel and lets you run Minecraft console commands from Discord via /mc or !mc, with access control and configurable log batching.
Автор: boondocksulfur1,2 тыс.4обновлён 8 окт. 2026 г.
ConsoleDiscord connects your Minecraft server console with Discord.
Mirrors your server log into a Discord text channel.
Lets you run console commands from Discord via /mc (slash command) or !mc (text command).
Perfect if you want to monitor and administer your server from Discord without opening the server console every time.
Features
🔁 Log streaming
Sends your server log to a configurable Discord channel.
💬 Commands from Discord
Execute console commands directly from Discord:
Slash command /mc
Optional text command !mc in a specific channel
🔐 Access control
Limit access to specific Discord user IDs and/or to a single command channel.
⚙️ Configurable log interval log-flush-ticks controls how often buffered log lines are sent to Discord.
🧪 Debug logging
Optional debug logging for JDA status changes (debug-status-logging).
🔄 Reload without restart /cdr reload reloads the config and reconnects to Discord if needed.
Requirements
Server: Paper / Bukkit-compatible server
Minecraft: 1.21.x (api-version: 1.21)
Java: 21
Discord: Your own bot
Bot token
Permissions to:
Read and send messages in the log/command channels
Use slash commands (for /mc, if enabled)
Installation
Drop the jar
Put ConsoleDiscord-1.0.0.jar into your server’s plugins/ folder.
Start the server
On first startup, the plugin will create a config.yml file in its folder.
Edit the config (plugins/ConsoleDiscord/config.yml)
bot-token: "YOUR_DISCORD_BOT_TOKEN"
# Text channel for server logs
log-channel-id: "123456789012345678"
# Optional: channel where /mc and !mc may be used
command-channel-id: ""
# Who is allowed to use /mc and !mc (user IDs).
# If empty, everyone is allowed.
allowed-user-ids:
- "123456789012345678"
# How often (in ticks) buffered log messages are flushed to Discord
log-flush-ticks: 40
# Log JDA status changes (connect, disconnect, etc.) to the server log
debug-status-logging: false
## [2.1.1] - 2026-10-08 — Bugfix & Compatibility Release
### Security
- Blocklist also checks server aliases (`rl` → `reload`) and commands nested in `execute … run` / `return run`.
- Bundled library logs (JDA) are no longer mirrored to Discord.
- Audit log escapes line breaks and records denied attempts (not allowed, blocked, rate limited).
- `!mc` denial replies are limited to one per user and minute; autocomplete only for allowed users.
- The bot no longer pings anyone; masked links in log lines are neutralized, command output can't break out of its code block.
### Fixed
- Embed log mode recognizes levels again (thread names with spaces or slashes were shown as INFO).
- Embed log lines always show the full console line incl. time (2.1.0 dropped it for single-word thread names).
- Embed log lines are shown literally: markdown (`dark_oak_button`) is escaped, Minecraft color codes are removed.
- A long entry such as a stack trace starts a new embed instead of cutting off the following lines.
- Performance alerts and auto-cleanup keep working after an automatic Discord reconnect.
- Long commands no longer break the Discord audit embed or suppress the command reply.
- `/cdr reload` no longer blocks the main thread while the old Discord connection or the audit writer shuts down.
- `DEBUG`/`TRACE` in `log-levels` are forwarded when the server's log4j configuration logs them.
- `auto-cleanup` values below 1 are clamped (0 days deleted every bot message, 0 hours ran every tick).
- Auto-cleanup reads the history from the cutoff, so busy channels (>1000 new messages) are cleaned too.
- Missing permissions in one channel only pause that channel instead of stopping all log forwarding.
- The watchdog no longer restarts JDA during its own reconnect (5 min grace) or after a failed login.
- The watchdog retries the Discord start if it failed with an exception (backoff up to 2 min).
- Disabling the plugin during a watchdog restart no longer leaves a Discord connection running.
- Code block mode splits long batches into several messages instead of dropping lines.
- Deleted default aliases, categories and patterns no longer come back on restart.
- Command aliases and messages are swapped atomically on reload (no race with Discord threads).
### Changed
- One jar for Minecraft 1.21.x and 26.x (Java 21 target, `api-version: '1.21'`).
- Update notice with clickable Modrinth + CurseForge links, in-game for `consolediscord.update` (OP), once per version on Discord, texts in `messages_*.yml`.
## [1.5.0] - 2026-07-11 — Security, Stability & Feature Release
Backport of the v2.1.0 changes from the Minecraft 26.x line: a full security and code review (fixes three attack vectors, five functional bugs and a packaging issue) plus a set of new quality-of-life features.
### ⚠️ Breaking Change
- **Empty whitelists now mean deny-all.** Previously an empty `allowed-user-ids` list allowed *every* Discord user in *every* server the bot was in to run console commands — with only `op`/`deop` blocked, anyone could run `stop`, `ban`, `whitelist add`, etc. Commands are now disabled until at least one Discord user ID (or role ID, see below) is whitelisted; a clear warning is logged on startup. **Migration:** add your Discord user ID to `allowed-user-ids` in `config.yml`.
### New Features
- **Command output replies:** `/mc` and `!mc` now reply with the actual command output (captured via Paper's feedback sender) instead of a generic "executing" note — e.g. `/mc list` shows the real player list in Discord. Configurable via `command-feedback` (enabled + collect window).
- **Role-based whitelist:** `allowed-role-ids` allows everyone holding one of the configured Discord roles to run commands — easier to manage for teams than individual user IDs.
- **`/cdr status`:** shows plugin version, server type, Discord connection state, configured channels (validated live), pending log queue size, whitelist counts and available updates.
- **`/cdr cleanup`:** manually triggers the message cleanup (the existing `cleanupNow()` logic was previously unreachable).
- **Tab completion** for all `/cdr` subcommands, filtered by permission.
- **Token via environment:** the bot token can be provided through the `CONSOLEDISCORD_BOT_TOKEN` environment variable, which takes precedence over `config.yml` — keeps the token out of config backups and support pastes.
- **Periodic update check:** the Modrinth check now repeats every `update-checker.interval-hours` (default 24, 0 = startup only) so long-running servers get notified too.
- **Audit log rotation:** `command-audit.max-file-size-mb` (default 10) rotates `audit.log` to `audit.log.old` so it no longer grows unbounded.
- **Startup notification** is now sent when the Discord connection is actually established instead of after a fixed 5-second delay (which silently skipped it on slow logins).
- **LICENSE file added** (MIT) — the README referenced it, but it didn't exist.
### Security
- Blocked-command checks can no longer be bypassed via plugin namespaces: **all** namespaced commands (`minecraft:op`, `essentials:op`, `anyplugin:cmd`, ...) are rejected. Previously only `minecraft:`, `bukkit:`, `spigot:` and `paper:` were caught, so `essentials:op` slipped past the `op` block.
- Leading slashes are stripped before the security check, so `/op` cannot bypass the `op` blocklist entry.
- `!mc` commands are ignored in direct messages — console access is only possible in guild channels where the channel restriction can apply.
- Default blocklist extended to `op`, `deop`, `stop`, `restart`, `reload`, `ban-ip` (existing configs keep their own list).
### Bugfixes
- Config validation no longer runs before JDA is connected — the channel cache was still empty right after startup, producing false "invalid channel-id" warnings on every start/reload. Validation now runs once the connection is established.
- Fixed a thread leak on `/cdr reload`: the previous `AuditLogger` writer thread is now shut down before a new one is created, and disabling the audit log via reload actually deactivates it.
- Fixed command aliases with a missing/non-string target being loaded as the literal command `"null"`; invalid aliases are now skipped with a warning. Alias keys are also normalized to lowercase so aliases with capital letters match.
- Fixed the shutdown notification potentially hanging `onDisable()` forever — `complete()` has no timeout and retries rate limits indefinitely; replaced with a hard 5-second timeout.
- Fixed oversized log lines producing an empty code block in Discord; overlong lines are now truncated instead of silently dropped.
### Improvements
- Watchdog reconnects no longer run on the main server thread — `stopDiscordStuff()` waits up to ~7s on JDA shutdown, which previously caused lag spikes on every reconnect attempt.
- A blocked command no longer consumes rate-limit quota (security check now runs before the rate limiter).
- `lastConnected`/`restartBackoffSec` are now `volatile` (written by the JDA event thread, read by the watchdog thread).
- Bulk message cleanup uses a 13-day boundary so messages close to Discord's 14-day bulk-delete limit don't fail while requests are queued.
- Test suite extended from 21 to 41 tests: new coverage for `LogFilter` (level/pattern/category filtering) and `LogFormatter` (Discord message/embed limits), plus new `CommandSecurity` bypass tests.
### Build
- All shaded JDA transitive dependencies (okhttp, okio, kotlin-stdlib, jackson, nv-websocket, commons-collections4, trove, tink, protobuf) are now relocated into the plugin's own namespace — previously they were shaded unrelocated and could clash with other plugins bundling the same libraries. `slf4j` and annotation-only artifacts are excluded from the JAR entirely.
**Build:** Java 21 | Paper 1.21.4 | JDA 6.1.0 | Folia supported
**Migration:** Swap the JAR **and add your Discord user ID to `allowed-user-ids`** (see Breaking Change above).
## [2.1.0] - 2026-07-10 — Security, Stability & Feature Release
Full security and code review of the plugin (fixes three attack vectors, five functional bugs and a packaging issue) plus a set of new quality-of-life features.
### ⚠️ Breaking Change
- **Empty whitelists now mean deny-all.** Previously an empty `allowed-user-ids` list allowed *every* Discord user in *every* server the bot was in to run console commands — with only `op`/`deop` blocked, anyone could run `stop`, `ban`, `whitelist add`, etc. Commands are now disabled until at least one Discord user ID (or role ID, see below) is whitelisted; a clear warning is logged on startup. **Migration:** add your Discord user ID to `allowed-user-ids` in `config.yml`.
### New Features
- **Command output replies:** `/mc` and `!mc` now reply with the actual command output (captured via Paper's feedback sender) instead of a generic "executing" note — e.g. `/mc list` shows the real player list in Discord. Configurable via `command-feedback` (enabled + collect window).
- **Role-based whitelist:** `allowed-role-ids` allows everyone holding one of the configured Discord roles to run commands — easier to manage for teams than individual user IDs.
- **`/cdr status`:** shows plugin version, server type, Discord connection state, configured channels (validated live), pending log queue size, whitelist counts and available updates.
- **`/cdr cleanup`:** manually triggers the message cleanup (the existing `cleanupNow()` logic was previously unreachable).
- **Tab completion** for all `/cdr` subcommands, filtered by permission.
- **Token via environment:** the bot token can be provided through the `CONSOLEDISCORD_BOT_TOKEN` environment variable, which takes precedence over `config.yml` — keeps the token out of config backups and support pastes.
- **Periodic update check:** the Modrinth check now repeats every `update-checker.interval-hours` (default 24, 0 = startup only) so long-running servers get notified too.
- **Audit log rotation:** `command-audit.max-file-size-mb` (default 10) rotates `audit.log` to `audit.log.old` so it no longer grows unbounded.
- **Startup notification** is now sent when the Discord connection is actually established instead of after a fixed 5-second delay (which silently skipped it on slow logins).
- **LICENSE file added** (MIT) — the README referenced it, but it didn't exist.
### Security
- Blocked-command checks can no longer be bypassed via plugin namespaces: **all** namespaced commands (`minecraft:op`, `essentials:op`, `anyplugin:cmd`, ...) are rejected. Previously only `minecraft:`, `bukkit:`, `spigot:` and `paper:` were caught, so `essentials:op` slipped past the `op` block.
- Leading slashes are stripped before the security check, so `/op` cannot bypass the `op` blocklist entry.
- `!mc` commands are ignored in direct messages — console access is only possible in guild channels where the channel restriction can apply.
- Default blocklist extended to `op`, `deop`, `stop`, `restart`, `reload`, `ban-ip` (existing configs keep their own list).
### Bugfixes
- Config validation no longer runs before JDA is connected — the channel cache was still empty right after startup, producing false "invalid channel-id" warnings on every start/reload. Validation now runs once the connection is established.
- Fixed a thread leak on `/cdr reload`: the previous `AuditLogger` writer thread is now shut down before a new one is created, and disabling the audit log via reload actually deactivates it.
- Fixed command aliases with a missing/non-string target being loaded as the literal command `"null"`; invalid aliases are now skipped with a warning. Alias keys are also normalized to lowercase so aliases with capital letters match.
- Fixed the shutdown notification potentially hanging `onDisable()` forever — `complete()` has no timeout and retries rate limits indefinitely; replaced with a hard 5-second timeout.
- Fixed oversized log lines producing an empty code block in Discord; overlong lines are now truncated instead of silently dropped.
### Improvements
- Watchdog reconnects no longer run on the main server thread — `stopDiscordStuff()` waits up to ~7s on JDA shutdown, which previously caused lag spikes on every reconnect attempt.
- A blocked command no longer consumes rate-limit quota (security check now runs before the rate limiter).
- `lastConnected`/`restartBackoffSec` are now `volatile` (written by the JDA event thread, read by the watchdog thread).
- Bulk message cleanup uses a 13-day boundary so messages close to Discord's 14-day bulk-delete limit don't fail while requests are queued.
- Test suite extended from 21 to 41 tests: new coverage for `LogFilter` (level/pattern/category filtering) and `LogFormatter` (Discord message/embed limits), plus new `CommandSecurity` bypass tests.
### Build
- All shaded JDA transitive dependencies (okhttp, okio, kotlin-stdlib, jackson, nv-websocket, commons-collections4, trove, tink, protobuf) are now relocated into the plugin's own namespace — previously they were shaded unrelocated and could clash with other plugins bundling the same libraries. `slf4j` and annotation-only artifacts are excluded from the JAR entirely.
**Build:** Java 25 | Paper 26.1.2 | JDA 6.1.0 | Folia supported
**Migration:** Swap the JAR **and add your Discord user ID to `allowed-user-ids`** (see Breaking Change above).
## [2.0.1] - 2026-06-05 — Bugfix, Tests & Setup Guide
Backport of the v1.4.2 fixes to the Minecraft 26.x / Java 25 line.
### Bugfixes
- Fixed Discord showing "command failed" for vanilla commands that actually ran — `Bukkit.dispatchCommand()`'s unreliable return value is no longer treated as success/failure; only a thrown exception counts as a failure. The audit log now records the real execution status.
- Fixed the `RateLimiter` memory leak for good — removed the self-defeating empty-entry churn (entries were removed and immediately re-added) and added a periodic `purgeExpired()` that runs automatically every 100 commands, keeping the tracking map bounded on busy public servers.
- Fixed `HttpURLConnection` not being released in `ModrinthUpdateChecker` — `disconnect()` is now called in a `finally` block.
### Improvements
- The plugin no longer forwards its own log messages to Discord, preventing echo/feedback noise (e.g. repeated send-error warnings looping back into the log channel).
- Added a JUnit 5 test suite (21 tests) covering `CommandSecurity`, `RateLimiter` and the update-checker version comparison; tests run on every build via Surefire.
- Added a bundled `SETUP.md` guide (installation + step-by-step Discord bot creation), automatically exported next to `config.yml` on first start.
## [1.4.2] - 2026-06-05 — Bugfix, Tests & Setup Guide
### Bugfixes
- Fixed Discord showing "command failed" for vanilla commands that actually ran — `Bukkit.dispatchCommand()`'s unreliable return value is no longer treated as success/failure; only a thrown exception counts as a failure. The audit log now records the real execution status.
- Fixed the `RateLimiter` memory leak for good — removed the self-defeating empty-entry churn (entries were removed and immediately re-added) and added a periodic `purgeExpired()` that runs automatically every 100 commands, keeping the tracking map bounded on busy public servers.
- Fixed `HttpURLConnection` not being released in `ModrinthUpdateChecker` — `disconnect()` is now called in a `finally` block.
### Improvements
- The plugin no longer forwards its own log messages to Discord, preventing echo/feedback noise (e.g. repeated send-error warnings looping back into the log channel).
- Added a JUnit 5 test suite (21 tests) covering `CommandSecurity`, `RateLimiter` and the update-checker version comparison; tests run on every build via Surefire.
- Added a bundled `SETUP.md` guide (installation + step-by-step Discord bot creation), automatically exported next to `config.yml` on first start.
- bStats metrics integration for anonymous usage statistics (moved here — the commit landed after the 1.4.1 release).
- Aligned `@version` JavaDoc tags across classes and corrected placeholder GitHub links in the README.
release
ConsoleDiscord 2.0.0
2.0.0
3 мая 2026 г.59Minecraft: 26.1, 26.1.1, 26.1.2folia, paper, purpur, spigot
## [1.4.0] - 2026-04-10 🚀 **Folia Support & Stability Release**
### ✨ New Features
**Folia Compatibility** ⭐
- **Full Folia support** - Plugin now works on both Paper and Folia servers
- **Automatic detection** - Detects server type and uses appropriate scheduler API
- **Zero configuration** - Works out of the box on both platforms
- **Region-aware scheduling** - Uses global region scheduler for console commands on Folia
- **Async scheduler migration** - All async tasks use Folia's new scheduler when available
**Modrinth Update Checker** ⭐
- Automatically checks for new versions on startup via Modrinth API
- Notification in server console and optionally in Discord channel
- Configurable: `update-checker.enabled`
**Config Auto-Merge** ⭐
- New config options from updates are automatically added to existing config
- User values are never overwritten - only missing keys are added
- No more manual config migration needed after updates
### 🐛 Bugfixes
- **Fixed: `MAX_EMBED_SIZE_EXCEEDED` error** - Embeds are now split into groups that respect Discord's 6000 character total limit per message. Previously, multiple embeds could exceed this limit and cause `ErrorResponseException: 50035`
- **Fixed: `Thread.sleep(1000)` blocking server shutdown** - Removed unnecessary sleep in `onDisable()`. The shutdown notification already uses blocking `complete()` call
- **Fixed: `CommandSecurity` race condition** - Static fields are now thread-safe using `AtomicBoolean` and `AtomicReference`. Config reloads during command checks no longer cause inconsistent state
- **Fixed: `SchedulerAdapter.isCancelled()` always returning `false`** - Folia tasks now properly track cancel state via `AtomicBoolean`, Paper tasks delegate to `BukkitTask.isCancelled()`
- **Fixed: Potential `NullPointerException` in `MessageCleanup`** - Added null-safety check for `jda.getSelfUser()` during message cleanup
- **Fixed: Fragile JSON parsing in `ModrinthUpdateChecker`** - Replaced manual `indexOf()`/`substring()` parsing with Gson for robust Modrinth API response handling
### 🔄 Changes
**Scheduler Refactoring**
- New `SchedulerAdapter` class provides unified API for Paper and Folia
- Replaced all `Bukkit.getScheduler()` calls with adapter methods
- Console commands now use `GlobalRegionScheduler` on Folia
- Removed busy-wait loops when cancelling tasks (cleaner shutdown)
**Code Cleanup**
- Removed legacy `org.example` package (outdated duplicate code from pre-1.3.0)
- Added Gson as provided dependency (shipped by Paper at runtime)
**Technical Details**
- Auto-detection via `io.papermc.paper.threadedregions.RegionizedServer` class check
- `folia-supported: true` flag in plugin.yml
- Backwards compatible with Paper/Spigot servers
### 📦 Build Information
**JAR File:** `consolediscord-1.4.0.jar`
**Size:** ~16 MB (with JDA shaded)
**Java Version:** 21
**Paper Version:** 1.21.4-R0.1-SNAPSHOT (also supports Folia)
**JDA Version:** 6.1.0
---
## Migration Guide from 1.3.0 → 1.4.0
### ✅ Automatic Migration
All changes are **100% backwards compatible**. Simply replace the JAR file!
New config options (like `update-checker`) are **automatically merged** into your existing `config.yml` on first startup - no manual editing needed.
## [1.2.0] - 2025-01-22
### Bugfixes
- **Discord Slash-Command Interaction Fix**: Behoben, dass beim Ausführen von `/mc cdr reload` der Fehler `IllegalStateException: This interaction has already been acknowledged` auftrat
- Slash-Commands verwenden jetzt `deferReply()` um Discord sofort zu bestätigen
- Antworten werden nun über `getHook().sendMessage()` gesendet
- JDA-Status wird geprüft bevor Antworten gesendet werden, um Race Conditions beim Reload zu vermeiden
- **Verbesserte Fehlerbehandlung**: Alle Discord-API-Aufrufe haben jetzt Error-Handler, die Fehler loggen statt Exceptions zu werfen
### Technische Details
- `DiscordListener.java`: Refactoring der `runMinecraftCommand()` Methode
- Neue Helper-Methode `sendResponse()` für saubere Trennung von Slash-Command und Message-Antworten
## [1.1.0] - Initiale Version
### Features
- Server-Konsolen-Logs werden automatisch in einen Discord-Channel gepostet
- Minecraft-Befehle können über Discord ausgeführt werden:
- `/mc <befehl>` - Slash-Command
- `!mc <befehl>` - Text-Prefix
- Konfigurierbare Berechtigungen (User-IDs)
- Optionaler Command-Channel für eingeschränkte Nutzung
- Watchdog für automatische JDA-Reconnects
- Debug-Modus für JDA-Status-Logging