Skip to content

Advanced Discord integration for Minecraft servers with real-time statistics and notifications.

Notifications You must be signed in to change notification settings

devnguyen0111/DN-Info

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

DN-Info

Advanced Discord integration for Minecraft servers with real-time statistics and notifications.

Version Minecraft Java

Features

📊 Real-Time Statistics

  • Server Information: Server name, version, uptime, IP and port
  • Player Statistics: Online players, max players, player list
  • Performance Metrics: TPS (Ticks Per Second), memory usage, CPU usage, disk space
  • World Statistics: World count, loaded chunks, entities, tile entities, mob counts
  • Customizable Updates: Configurable update intervals (default: 60 seconds)

🔔 Event Notifications

  • Player join/quit notifications
  • Player death notifications
  • Player advancement notifications
  • Server start/stop notifications

⚙️ Advanced Features

  • TPS Monitoring: Real-time TPS calculation using rolling average
  • Message Editing: Updates the same Discord message instead of spamming
  • Async Operations: Non-blocking webhook requests for better performance
  • Configurable Stats: Enable/disable individual statistics via config
  • Customizable Messages: Configure embed title, color, footer, and thumbnail

Requirements

  • Minecraft: 1.21 or higher
  • Server Software: Spigot or Paper
  • Java: 21 or higher

Installation

  1. Download the latest DN-Info-0.1.jar from the Releases page
  2. Place the JAR file in your server's plugins folder
  3. Start your server (or use /reload)
  4. Edit plugins/DN-Info/config.yml and set your Discord webhook URL
  5. Restart your server or use /dninfo reload

Configuration

Basic Setup

  1. Get a Discord Webhook URL:

    • Go to your Discord server settings
    • Navigate to Integrations → Webhooks
    • Create a new webhook or use an existing one
    • Copy the webhook URL
  2. Configure the Plugin: Open plugins/DN-Info/config.yml and set:

    webhook:
      url: "YOUR_WEBHOOK_URL_HERE"
      update-interval: 60 # Update interval in seconds

Statistics Configuration

Enable or disable individual statistics in config.yml:

stats:
  # Server Information
  server-name: true
  server-version: true
  server-uptime: true
  server-ip: true

  # Player Statistics
  online-players: true
  max-players: true
  player-list: false # Can be long on large servers

  # Performance Statistics
  tps: true
  memory-used: true
  memory-max: true
  memory-percentage: true
  cpu-usage: true
  disk-space: true

  # World Statistics
  world-count: true
  world-names: false
  loaded-chunks: true
  entities: true
  tile-entities: true
  mob-count: true

  # Other
  plugins-count: false

Event Notifications

Configure event notifications in config.yml:

notifications:
  player-join:
    enabled: false
    message: "🎮 **{player}** joined the server! ({online} online)"
    color: 0x00FF00

  player-quit:
    enabled: false
    message: "👋 **{player}** left the server! ({online} online)"
    color: 0xFF9900

  player-death:
    enabled: false
    message: "💀 **{player}** {death}"
    color: 0xFF0000

  player-advancement:
    enabled: false
    message: "🏆 **{player}** made the advancement **{advancement}**!"
    color: 0xFFD700

  server-start:
    enabled: true
    message: "🟢 **Server is now online!**"
    color: 0x00FF00

  server-stop:
    enabled: true
    message: "🔴 **Server is now offline!**"
    color: 0xFF0000

Message Customization

Customize the Discord embed appearance:

message:
  title: "📊 Server Statistics"
  color: 0x00FF00 # Hex color code
  footer: "Last updated"
  show-timestamp: true
  thumbnail: "" # Optional thumbnail image URL

Commands

Command Permission Description
/dninfo or /dni dninfo.info Show plugin help or information
/dninfo update dninfo.update Manually update Discord stats
/dninfo reload dninfo.reload Reload plugin configuration
/dninfo info dninfo.info Show plugin information

Permission Nodes

  • dninfo.* - All permissions (default: OP)
  • dninfo.update - Allow manual stats update (default: OP)
  • dninfo.reload - Allow reloading config (default: OP)
  • dninfo.info - View plugin info (default: true)

Building from Source

  1. Prerequisites:

    • Java 21 or higher
    • Maven 3.6 or higher
  2. Clone the repository:

    git clone https://github.com/devnguyen0111/DN-Info.git
    cd DN-Info
  3. Build the plugin:

    mvn clean package
  4. The compiled JAR will be in the target directory: target/DN-Info-0.1.jar

How It Works

  1. TPS Monitoring: The plugin monitors server ticks every tick to calculate real-time TPS using a rolling average of the last 100 ticks.

  2. Stats Collection: Every update interval, the plugin collects configured statistics on the main thread (synchronous).

  3. Discord Updates: Stats are sent to Discord via webhook on an async thread to avoid blocking the server.

  4. Message Editing: The plugin edits the same Discord message instead of creating new ones, preventing spam in your Discord channel.

  5. Event Notifications: When enabled, player events (join, quit, death, advancements) and server events (start, stop) trigger separate Discord notifications.

Troubleshooting

Plugin doesn't send stats to Discord

  • Check webhook URL: Make sure you've set a valid Discord webhook URL in config.yml
  • Check console: Look for error messages in your server console
  • Check permissions: Ensure the webhook URL is correct and the Discord channel allows webhooks

Stats not showing certain information

  • Check config.yml: Verify that the specific stat is enabled in the stats section
  • Check permissions: Some stats require server access (e.g., disk space may not be available on all servers)

TPS shows incorrectly

  • The TPS monitor uses a rolling average, so it may take a few seconds to stabilize after server startup
  • For more accurate TPS, ensure the server has been running for at least 5 seconds

Support

License

This project is licensed under the MIT License - see the LICENSE file for details.

Credits

  • Author: devnguyen0111
  • Built with: Spigot API, Gson

Made with ❤️ for the Minecraft community

About

Advanced Discord integration for Minecraft servers with real-time statistics and notifications.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages