MINECRAFT DISCORD REMOTE ADMINISTRATION PLUGIN
ROLE
You are an expert Minecraft plugin developer specializing in Paper, Spigot, Java, Discord bots, Discord Slash Commands, secure remote server administration, and Minecraft server management.
Build a complete, production-ready Minecraft plugin that connects a Minecraft server to a Discord bot and allows authorized Discord users to execute Minecraft server commands remotely.
- PROJECT DETAILS
- Plugin Name: CrazyDiscordControl
- Plugin Version: 1.0.0
- Author: CrazyGamerz95YT
- Target Platform: Paper
- Minecraft Compatibility: 1.21.x, including 1.21.11
- Java Compatibility: Java 21+
- Discord Integration: Official Discord bot using Discord Slash Commands
- Build System: Maven
- Main Language: Java
- Primary Goal: Securely control Minecraft servers directly through Discord.
Use a lightweight architecture with minimal dependencies and optimized performance.
- DISCORD BOT CONNECTION
The plugin must connect to Discord using a bot token configured in config.yml or, preferably, an environment variable.
Requirements:
- Connect to a Discord bot using a supported Java Discord library such as JDA.
- Register Discord slash commands automatically.
- Support a configurable Discord Server ID.
- Support configurable allowed Discord user IDs and role IDs.
- Allow configuration of one or multiple authorized Discord channels.
- Automatically reconnect after temporary Discord connection failures.
- Display the Minecraft server's connection status in Discord.
- Never expose the bot token in logs, Discord messages, or command responses.
- Never block Minecraft's main server thread while waiting for Discord API responses.
The Discord bot must execute commands on the Minecraft server to which the plugin is connected.
- UNIVERSAL COMMAND — /send
Create this Discord slash command:
/send command:<Minecraft command>
Examples:
/send command:"time set day" /send command:"weather clear" /send command:"say Hello from Discord!" /send command:"difficulty normal" /send command:"gamerule keepInventory true" /send command:"gamemode creative Steve" /send command:"give Steve diamond 16"
Behavior:
- Accept a Minecraft command without the leading slash.
- Execute it through the Minecraft server console.
- Return the execution status in a clean Discord embed.
- Include the command that was executed.
- Show a success or failure status where determinable.
- Prevent unauthorized users from executing commands.
- Reject empty, malformed, or excessively long commands.
- Record command execution in the audit log.
IMPORTANT SECURITY RULE:
The /send command provides powerful console access. Restrict it to explicitly authorized Discord user IDs or roles. Never make it available to every Discord member.
- QUICK DISCORD SLASH COMMANDS
Create the following shortcuts.
GAMEMODE COMMANDS
/gmc player:<player> Executes: gamemode creative <player>
/gms player:<player> Executes: gamemode survival <player>
/gma player:<player> Executes: gamemode adventure <player>
/gmsp player:<player> Executes: gamemode spectator <player>
PLAYER MANAGEMENT
/kill player:<player> Executes: kill <player>
/heal player:<player> Executes: effect give <player> minecraft:instant_health 1 10 true
/feed player:<player> Executes: effect give <player> minecraft:saturation 5 1 true
/fly player:<player> enabled:<true|false> When enabled is true, execute the configured flight command for the player.
When false, disable flight using the configured compatible command.
NOTE: Minecraft does not provide a universal vanilla /fly command. Implement flight using a proper server API or a configurable command.
TELEPORTATION
/tp player:<player> target:<target> Executes: tp <player> <target>
/tphere player:<player> Teleports the specified player to the configured authorized staff member or uses a clearly defined target argument.
/spawn player:<player> Executes the configured spawn command for the specified player.
Make spawn-command handling configurable because it may depend on installed plugins.
TIME AND WEATHER
/day Executes: time set day
/night Executes: time set night
/sun Executes: weather clear
/rain Executes: weather rain
/thunder Executes: weather thunder
SERVER MANAGEMENT
/online Show currently online players, total player count, and server maximum player count.
/list Display the current online player list.
/tps Display available server TPS and performance information.
/serverinfo Display:
- Server software and version
- Minecraft version
- Online players
- Maximum player slots
- Current TPS when supported
- Server uptime
- Plugin version
/announce message:<message> Broadcast a formatted announcement to all online players.
/broadcast message:<message> Provide a convenient alias for the announcement functionality.
/save Execute: save-all
/whitelist player:<player> action:<add|remove> Execute the corresponding vanilla whitelist command.
/kick player:<player> reason:<reason> Execute the kick command with a properly handled reason.
/ban player:<player> reason:<reason> Execute the ban command with a properly handled reason.
/pardon player:<player> Execute: pardon <player>
/op player:<player> Execute: op <player>
/deop player:<player> Execute: deop <player>
HIGH-RISK COMMANDS:
Commands such as /op, /deop, /ban, /pardon, and /send must have explicit permission checks.
Optionally require a separate high-privilege Discord role for especially sensitive commands.
Do not create any public or unrestricted administrative command.
- DISCORD EMBED DESIGN
Use a professional CrazyNetwork-inspired dark blue and cyan visual style.
Command Success Embed
Title: ⚡ CrazyDiscordControl
Description:
Minecraft command executed successfully.
Fields:
- Command
- Executed By
- Minecraft Server
- Execution Time
- Status
Footer:
CrazyNetwork • Discord Remote Administration
Command Failure Embed
Title: ❌ Command Execution Failed
Display:
- Requested command
- Error or failure reason when safely available
- Executing Discord user
- Timestamp
Never reveal secrets, bot tokens, stack traces, or sensitive server configuration.
Online Players Embed
Title: 🟢 Minecraft Server Status
Display:
- Online players: X/Y
- Online player names
- Server uptime
- TPS when available
- Connection status
Handle empty player lists cleanly.
- PERMISSION SYSTEM
Implement configurable permissions.
Configuration example:
discord: guild-id: "YOUR_DISCORD_SERVER_ID" bot-token-env: "DISCORD_BOT_TOKEN" allowed-channel-ids:
- "YOUR_ADMIN_CHANNEL_ID"
permissions: allowed-user-ids:
- "YOUR_DISCORD_USER_ID"
allowed-role-ids:
- "YOUR_ADMIN_ROLE_ID"
allow-send: true allow-gamemode: true allow-teleport: true allow-player-management: true allow-server-management: true allow-op-management: false
require-high-privilege-role-for-send: true require-high-privilege-role-for-op: true
IMPORTANT:
- Replace example IDs with configurable values.
- Do not hardcode Discord IDs.
- Verify guild membership and role permissions.
- Deny commands by default if authorization cannot be verified.
- Ignore commands from bots unless explicitly configured.
- Do not rely on Discord channel permissions alone.
- Apply permission checks individually to every command.
- AUDIT LOGGING
Record every administrative action.
Each audit entry should include:
- Timestamp
- Discord username and user ID
- Discord channel ID
- Minecraft server name
- Command name
- Sanitized command arguments
- Execution result
Support configurable console logging and an optional local log file.
Do not log bot tokens or other secrets.
Provide an optional Discord audit-log channel.
- THREAD SAFETY AND PERFORMANCE
This is essential.
- Never perform blocking Discord network operations on the Minecraft main thread.
- Schedule Minecraft API operations on the appropriate server thread.
- Handle Discord interactions asynchronously.
- Respond to Discord interactions promptly.
- Use proper interaction deferral when necessary.
- Prevent duplicate command execution.
- Avoid unnecessary background threads and excessive polling.
- Shut down Discord connections cleanly when the plugin disables.
- Handle Minecraft server shutdown and Discord outages gracefully.
- CONFIGURATION
Generate a complete config.yml containing:
- Discord bot settings
- Guild and channel IDs
- Allowed Discord user and role IDs
- Permission toggles
- High-risk command settings
- Audit logging
- Embed colors and branding
- Configurable command aliases
- Configurable spawn and flight integrations
- Server display name
Provide a safe example configuration without real credentials.
Never commit a real bot token to source control.
- ERROR HANDLING
Handle:
- Invalid or missing player names
- Offline players
- Missing Discord permissions
- Unauthorized Discord users
- Wrong Discord channels
- Discord API outages
- Invalid command arguments
- Plugin shutdown
- Missing optional plugins
- Unsupported Minecraft versions
- Malformed configuration
- Rate-limited Discord requests
Return concise, user-friendly error embeds.
For commands requiring online players, validate the player before execution whenever possible.
- PROJECT STRUCTURE
Create a clean Maven project containing:
- Main plugin class
- Discord connection manager
- Slash command registration manager
- Command execution service
- Permission and authorization manager
- Player management commands
- Server information commands
- Embed builder
- Audit logger
- Configuration manager
- plugin.yml
- config.yml
- pom.xml
- README.md
- .gitignore
Keep the implementation modular and maintainable.
- BUILD AND DELIVERY REQUIREMENTS
Deliver the complete working source code.
Requirements:
- Generate every required Java file.
- Generate plugin.yml and config.yml.
- Generate a complete pom.xml with compatible dependencies.
- Include instructions for creating a Discord bot and obtaining its token.
- Explain how to invite the bot with the necessary Discord permissions.
- Explain how to configure Discord user IDs, role IDs, and channel IDs.
- Explain how to build the plugin using Maven.
- Explain how to install and configure it on Paper.
- Explain how to configure the environment variable for the bot token.
- Include troubleshooting instructions.
- Verify command registration and authorization logic.
- Avoid pseudocode, incomplete methods, and placeholder implementations in the actual code.
- Ensure that all advertised commands are implemented.
- Test compilation and fix build errors before delivery.
- Provide the final compiled plugin JAR and the complete source project as a ZIP.
FINAL OBJECTIVE
Create a lightweight, secure, professional Discord-to-Minecraft administration plugin that lets authorized CrazyNetwork staff control their Minecraft server through Discord slash commands.
The /send command must support authorized console command execution, while quick commands such as /gmc, /gms, /day, /night, /online, /kick, /ban, /tp, and /serverinfo must provide convenient shortcuts.
Prioritize security, reliability, clean Discord embeds, correct Paper API usage, and production-ready implementation.
Create the Maven project, Paper metadata, and safe example configuration.
Implement Discord connection, authorization, slash commands, server-thread execution, embeds, and audit logging.
Add setup and troubleshooting guidance; Kodari will compile the project for the downloadable plugin JAR.
Created the CrazyDiscordControl Maven project with guild-scoped slash commands, per-command authorization, high-privilege role checks, async Discord connection handling, server-thread command execution, and console/file/optional Discord audit logging. The bot token is read from DISCORD_BOT_TOKEN by default; allowed IDs and channels are intentionally empty, so access is denied until you configure them.
Set the guild, channel, user, and role IDs in src/main/resources/config.yml. Configure commands.spawn and commands.tphere-target-player for your server. Console dispatch reports whether Bukkit accepted a command; that does not always confirm the command succeeded in-game.
To compile and download the JAR in Kodari, click Compile in the desktop top bar—or ⋮ → Compile Project on phone—then click Compile and Download when the build succeeds. The complete source is in the project workspace.
package com.crazynetwork.crazydiscordcontrol;
import com.crazynetwork.crazydiscordcontrol.audit.AuditLogger;
import com.crazynetwork.crazydiscordcontrol.config.ConfigManager;
import com.crazynetwork.crazydiscordcontrol.discord.DiscordManager;
import com.crazynetwork.crazydiscordcontrol.security.AuthorizationManager;
import org.bukkit.plugin.java.JavaPlugin;
public final class CrazyDiscordControl extends JavaPlugin {
private ConfigManager configManager;
private AuditLogger auditLogger;
private AuthorizationManager authorizationManager;
private DiscordManager discordManager;
private final long startedAt = System.currentTimeMillis();
@Override
public void onEnable() {
saveDefaultConfig();
configManager = new ConfigManager(this);
auditLogger = new AuditLogger(this, configManager);
authorizationManager = new AuthorizationManager(configManager);
discordManager = new DiscordManager(this, configManager, authorizationManager, auditLogger);
discordManager.start();
getLogger().info("CrazyDiscordControl enabled.");
}
@Override
public void onDisable() {
if (discordManager != null) {
discordManager.stop();
}
}
public long getStartedAt() {
return startedAt;
}
}