DiscordPlugin Functionality Documentation
Overview
Discord Status is a Bukkit plugin that enables interaction between a Minecraft server and a Discord channel. This plugin utilizes a Discord bot to update the status of the Minecraft server in real time on Discord and displays the number of players on the server.
Features
Discord Bot Integration
- Creates a Discord bot that displays the status of the Minecraft server.
- Uses the Discord API to set the online player information from the server as the Discord status.
Configuration File Management
- The plugin uses a config.yml file to store and manage the Discord bot's token.
- Users must input their Discord token in this file; if the token is absent, the plugin will be disabled.
Online Player Information Update
- Uses BukkitRunnable to periodically update the number of online players on the Minecraft server to the Discord status.
- Status updates are executed every 60 seconds.
Exception Handling
- If an invalid Discord token is provided, the plugin will be disabled, and an error message will be logged.
Plugin Shutdown Handling
- Safely shuts down the Discord bot when the plugin is disabled.
- Disables JDA (Java Discord API) logging to reduce log output.
Installation and Setup
Plugin Installation
- Copy the DiscordPlugin.jar file to the plugins folder of the Minecraft server.
Configuration File Creation
- When the server starts, a config.yml file will be automatically generated. Input the Discord bot's token in the discord.token entry of this file.
Server Restart
- After saving the configuration file, restart the server to activate the plugin.
Usage Example
You can monitor the current number of players on the Minecraft server in real time by checking the bot's status on Discord. For example: 3/20 (indicating that there are currently 3 players online out of a maximum of 20).
Caution
- Be careful not to share your Discord token unofficially with others.
- If an invalid token is entered, the plugin may not function properly.