Fixed duplicate Telegram messages — Messages from Telegram were sometimes delivered 2-3 times to Minecraft. Root cause was overlapping long-poll requests. Fixed with an atomic polling guard.
Fixed /sudo command crashes — The sudo command would crash in non-forum groups because it tried to access message_thread_id even when it didn't exist. Now handles missing thread IDs gracefully.
Fixed /sudo not showing output — Previously, /sudo plugins would say "executed successfully" but show no output. Now captures and displays full command output in Telegram.
Fixed multi-line message prefix spam — Multi-line messages from Telegram had the plugin prefix prepended to every line. Now the prefix is applied only once.
Fixed HTML entity corruption — HTML entities like < were being corrupted by the color code stripper. Now HTML entities are preserved correctly through the entire message pipeline.
Fixed /reload causing Telegram message flood — Using /reload from Telegram caused an infinite loop. Reload is now only available in-game.
Fixed /sudo crashing with vanilla commands — Now uses console sender with logger capture for reliable command output.
Fixed chat mention plugin garbage in Telegram — Plugin-injected component tags are now cleaned before forwarding.
New Features
Server Start/Stop Notifications — Get notified in Telegram when your server starts or stops
First Join Detection — Special welcome messages for players joining for the first time
Anti-Flood System — Configurable rate limiting prevents message flooding
Sudo Output Capture — /sudo commands now show their full output in the Telegram response
Look for "chat":{"id": -123456789} in its response — that number is your Chat ID
Remove RawDataBot from the group
For Forum Groups (with topics): Send a message in the specific topic where you want notifications. RawDataBot will show a
"message_thread_id" — that's your
Thread ID.
Step 4: Configure the Plugin
Edit
plugins/TelegramLogger/config.yml:
Code (YAML):
# Required: Your bot token from BotFather bot_token: "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"
# Required: Your group/channel chat ID chat_id: "-1001234567890"
# Optional: Thread ID for forum topics thread_id: "123" send_to_thread: false
Save the file and run
/tl reload in-game, or restart the server.
Register yourself as an admin (required for Telegram commands):
Code (Text):
/tl admin add YOUR_TELEGRAM_USER_ID YourName
To find your Telegram user ID, send a message in the group with RawDataBot and look for
"from":{"id": 123456}.
Configuration Reference
Code (YAML):
bot_token: "BOT_TOKEN"# Your Telegram bot API token chat_id: "CHAT_ID"# Target group/channel ID thread_id: "THREAD_ID"# Forum topic thread ID send_to_thread: false
# Enable forum topic support send_telegram_messages_to_game: false
# Forward Telegram messages to Minecraft
Code (YAML):
plugin_prefix: "&6&lTelegramLogger&7 -> &r&a"# In-game message prefix (supports color codes) telegram_game_message: "&7[&9TG&7] &c%name% &8>> &f%message%"# Format for TG->MC messages
The
telegram_game_message template controls how Telegram messages appear in Minecraft.
Available placeholders:
%name% (sender name),
%message% (message text).
Replace ugly in-game rank prefixes with clean text for Telegram messages. The key is the text to find in the player's display name, and the value is what to replace it with. Prefix is fetched from Vault API (works with LuckPerms, PEX, etc.) and falls back to display name extraction if Vault is not installed.
HTML support: Replacement values support full Telegram HTML including custom emoji (
<tg-emoji>), bold, italic and other tags. Values are sent as raw HTML without escaping. If no replacement matches, the prefix is auto-escaped for safety.
Sends a notification to Telegram when the server starts or shuts down.
Placeholders:
%version%,
%max%.
Code (YAML):
enable_join: true
join_message: "<blockquote>%player% joined the game! (%online%/%max%)</blockquote>" enable_leave: true
leave_message: "<blockquote>%player% left the game! (%online%/%max%)</blockquote>"
Code (YAML):
enable_first_join: true
first_join_message: "<blockquote>%player% joined for the first time! Welcome! (%online%/%max%)</blockquote>"
Triggers only when a player joins the server for the very first time (detected via
player.hasPlayedBefore()).
When enabled, registered admins can execute server commands from Telegram:
Code (Text):
/sudo list -> Shows online players
/sudo plugins -> Lists installed plugins with output
/sudo kill Steve -> Kills the player Steve
/sudo say Hello! -> Broadcasts a message
/sudo gamemode creative Steve -> Changes gamemode
The response shows:
Whether the command succeeded
The actual command that was executed
Which admin ran it
The full command output (if sudo_show_output: true)
Commands in
sudo_blacklist are blocked from execution for safety.
Code (YAML):
anti_flood_enabled: true
anti_flood_max_messages: 20
# Maximum messages allowed per window anti_flood_window_seconds: 10
# Window duration in seconds
Prevents flooding in situations like:
Mass player join/leave events
Chat spam
Rapid advancement unlocks
Event storms
Messages that exceed the rate limit are silently dropped.
Code (YAML):
debug_mode: false
Enable with
/tl debug in-game or
/debug from Telegram. Shows detailed logs for message processing, Telegram API calls, config loading, rate limiting decisions, and admin checks.
Commands Reference
In-Game Commands All commands require the
telegramlogger.admin permission (default: op).
Command
Alias
Description
/telegramlogger reload
/tl reload
Reload configuration from disk
/telegramlogger start
/tl start
Start message forwarding
/telegramlogger stop
/tl stop
Stop message forwarding
/telegramlogger stats
/tl stats
View detailed message statistics
/telegramlogger status
/tl status
Show plugin and bot status
/telegramlogger debug
/tl debug
Toggle debug mode
/telegramlogger admin add <id> <name>
/tl admin add <id> <name>
Register a Telegram admin
/telegramlogger admin remove <id>
/tl admin remove <id>
Remove a Telegram admin
/telegramlogger admin list
/tl admin list
List all registered admins
/telegramlogger help
/tl help
Show help message
Telegram Commands All commands require the sender to be a registered admin.
Command
Description
/status
Show plugin status, features, server info, and memory
/stats
View message statistics with counts and percentages
/players or /online
List online players (up to 20, with admin crowns)
/tps
Show server TPS (1m/5m/15m) and memory usage
/start
Start message forwarding
/stop
Stop message forwarding
/debug
Toggle debug mode
/sudo <command>
Execute a server command (if enabled)
/help
Show available commands
Admin Management
Admins are Telegram users who can:
Send messages to the Minecraft chat from Telegram
Use Telegram commands (/status, /stats, etc.)
Execute server commands via /sudo (if enabled)
Registering an Admin:
Code (Text):
/tl admin add 123456789 Steve
Where
123456789 is the Telegram user ID and
Steve is a display name.
Removing an Admin:
Code (Text):
/tl admin remove 123456789
Listing Admins:
Code (Text):
/tl admin list
Admin data is stored in
plugins/TelegramLogger/admins.json and persists across restarts.
Important: An admin must be both:
Registered via /tl admin add
A group administrator or creator in the Telegram group
Message Placeholders
Available placeholders vary by message type:
Placeholder
Available In
Description
%player%
All player events
Player username
%displayname%
All player events
Player display name (may include colors)
%prefix%
All player events
Player rank prefix (extracted from display name)
%suffix%
All player events
Player rank suffix (extracted from display name)
%online%
All events
Current online player count
%max%
All events
Maximum player slots
%message%
Chat messages
The chat message content
%command%
Command logging
The executed command
%death_message%
Death messages
Full death message from Minecraft
%advancement%
Advancement messages
Achievement name
%from_world%
World switch
Previous world (with emoji)
%to_world%
World switch
New world (with emoji)
%version%
Server start
Server version string
%name%
Telegram->MC messages
Telegram sender name
HTML Formatting Guide
Telegram supports HTML formatting in messages. Use these tags in your message templates:
Code (HTML5):
<b>Bold text
</b> <i>Italic text
</i> <u>Underlined text
</u> <s>Strikethrough text
</s> <code>Monospace/code text
</code> <pre>Preformatted block
</pre> <blockquote>Quoted text block
</blockquote> <ahref="https://example.com">Link text
</a>
Code (YAML):
# Fancy join message join_message: "<blockquote><b>%player%</b> has joined!\nPlayers: <code>%online%/%max%</code></blockquote>"
# Death message with formatting death_message: "<blockquote><i>%death_message%</i>\n<code>%online%/%max%</code></blockquote>"
# Minimal chat format chat_message: "<b>%player%</b>: %message%"
Telegram forum groups (supergroups with topics) let you organize different event types into separate threads:
Code (YAML):
# Main events go to one thread send_to_thread: true
thread_id: "12345"
# Command logs go to a different thread (or even a different group) enable_send_command_executes: true
command_executes_chat_id: "-1001234567890" send_command_executes_to_thread: true
command_executes_group_thread_id: "67890"
This keeps your server events organized and easy to navigate.
Statistics and Metrics
The plugin tracks comprehensive statistics:
Metric
Description
Total Messages
All messages sent to Telegram
Join Messages
Player join event count
Leave Messages
Player leave event count
Chat Messages
Chat messages forwarded
Advancement Messages
Achievements forwarded
Death Messages
Death events forwarded
World Switch Messages
Dimension changes forwarded
Filtered Messages
Messages blocked by chat filter
First Join Messages
New player welcome messages
Command Messages
Commands logged
Server Start Count
Number of server starts logged
View statistics:
In-game:/tl stats — Shows progress bars and percentages
# Clone the repository
git clone https://github.com/LazizbekDeveloper/TelegramLogger.git
cd TelegramLogger
# Build the plugin
mvn clean package
# The output JAR will be at:
# target/TelegramLogger-5.0.1.jar
The build process compiles all Java sources against Spigot API 1.16.5, shades Google GSON into the jar (relocated to avoid conflicts), and produces a single self-contained JAR file. The output JAR is ready to use — just drop it in your
plugins/ folder.
Troubleshooting
Check your bot token — Make sure it's copied correctly from BotFather
Bot must be a group admin — Add the bot as an administrator in your Telegram group
Verify the chat ID — Use RawDataBot to confirm the correct group ID
Privacy mode — Send /setprivacy to BotFather and set it to Disable for your bot
Check /tl status — Shows if the bot connection is active
Check feature toggles — Make sure enable_join, enable_chat, etc. are true
Check anti-flood — If too many events fire at once, some may be rate-limited
Enable debug mode — Run /tl debug and check console for errors
Verify config is valid — Run /tl reload and check for error messages
Enable the feature — Set send_telegram_messages_to_game: true
Register as admin — Use /tl admin add <your_telegram_id> <name>
Must be group admin — Your Telegram account must be a group admin AND registered
Enable sudo — Set enable_sudo_command: true in config
Check blacklist — The command might be in sudo_blacklist
Register as admin — Must be registered via /tl admin add
Check output — The command might execute but produce no visible output
This was a known issue in v4.x and is fixed in v5.0.0. If you're still experiencing it:
Make sure you're running v5.0.0 or newer
Try /tl reload to restart the polling system
Thread ID must match — Use RawDataBot in the specific topic to get the correct thread ID
send_to_thread must be true — Otherwise thread_id is ignored
Bot must have topic permissions — Ensure the bot can post in the specific topic
The plugin handles this automatically in v5.0.0:
The broken config is saved as config.yml.broken.<timestamp>
A fresh config is generated
Recoverable values are migrated
You can also manually fix issues by:
Checking the broken file for YAML syntax errors
Using a YAML validator (e.g., yamllint.com)
Common issues: missing quotes, tab characters (use spaces), unclosed strings
FAQ
Q: Does this plugin work with Paper? A: Yes! TelegramLogger works with any Spigot-based server including Paper, Purpur, and forks.
Q: Can I use this with multiple Telegram groups? A: The main events go to one group/thread. Command logging can go to a separate group via
command_executes_chat_id.
Q: Is the bot token stored securely? A: The bot token is stored in config.yml on your server. Make sure your server files are properly secured.
Q: How do I find my Telegram user ID? A: Add
@RawDataBot to a group, send a message, and look for
"from":{"id": YOUR_ID}.
Q: Can regular players use Telegram commands? A: No. Only users who are both registered admins AND Telegram group admins can use commands.
Q: Does /sudo have any limitations? A: Yes — commands in sudo_blacklist are blocked. Output is truncated to 3000 characters. The command runs as console (full permissions).
Q: What happens if Telegram is down? A: The plugin gracefully handles API failures. Events continue to be tracked locally. Messages are simply not sent until the API is available again.
Q: How much server performance does this use? A: Minimal. All Telegram communication is asynchronous and runs off the main thread. The anti-flood system prevents excessive API calls.
Q: Can I customize the emoji in world names? A: Currently, world name formatting is built-in. Custom world names are auto-formatted. You can customize the message templates to add your own emoji.
Code (YAML):
# TelegramLogger v5.0.1 # Developed by LazizbekDev # https://t.me/LazizbekDev
# --------------------- # Server Start/Stop # --------------------- enable_server_start_stop: true
server_start_message: "<blockquote>Server started!\nVersion: %version% | Max Players: %max%</blockquote>" server_stop_message: "<blockquote>Server stopped!</blockquote>"
# --------------------- # Join Messages # --------------------- enable_join: true
join_message: "<blockquote>%player% joined the game! (%online%/%max%)</blockquote>"
# --------------------- # First Join # --------------------- enable_first_join: true
first_join_message: "<blockquote>%player% joined for the first time! Welcome! (%online%/%max%)</blockquote>"
# --------------------- # Leave Messages # --------------------- enable_leave: true
leave_message: "<blockquote>%player% left the game! (%online%/%max%)</blockquote>"