itzfroxypie

πŸ”₯ PLUGIN SPEC: Discord DM Bridge (PaperMC 1.21.x)

🎯 Overview

Create a PaperMC plugin that integrates Minecraft server with a Discord bot using JDA. The plugin allows Discord-controlled messaging and DM system to Discord users. Minecraft side acts only as bridge; all communication and actions are handled through Discord.

---

βš™οΈ Requirements

* Minecraft: PaperMC 1.21.x * Java: 17+ * Discord API: JDA (latest stable) * Single plugin JAR install (drag & drop) * Config file required only for bot token + guild ID

---

πŸ€– Core System

1. Discord Bot Connection

* Bot connects on server startup * Reads token from config.yml * Auto-reconnect on crash * Logs β€œBot Connected Successfully”

---

2. DM SYSTEM (MAIN FEATURE)

Bot must support:

#### Commands:

* !dmrole @Role <message> β†’ Sends DM to all users with that role

* !dmall <message> β†’ Sends DM to all members (ADMIN ONLY)

* !subscribe β†’ Adds user to DM list

* !unsubscribe β†’ Removes user from DM list

---

3. DM RULES

* Must use 2-second delay between each DM * Must handle failed DMs (skip users with closed DMs) * Must log success/failure count * Must prevent spam loop execution * Must NOT crash if user DM is disabled

---

4. BOT DM USER BEHAVIOR

* Bot sends DM as itself (Discord bot account) * Format: πŸ”₯ Header message πŸ“’ Custom server message βš”οΈ SMP event info if included

---

5. OPTIONAL MINECRAFT INTEGRATION

Minecraft plugin can:

* Broadcast messages from Discord β†’ Minecraft chat * Show alerts in-game from Discord commands * Send player list to Discord

---

πŸ“ CONFIG FILE

config.yml:

yml
bot-token: "YOUR_TOKEN"
guild-id: "YOUR_GUILD_ID"
dm-delay: 2000

---

πŸ’¬ DISCORD COMMAND SYSTEM

* !say <message> β†’ Minecraft broadcast * !alert <message> β†’ Minecraft title alert * !list β†’ online players * !dmrole β†’ role-based DM system * !dmall β†’ admin broadcast DM * !subscribe β†’ opt-in DM system

---

πŸ”’ SECURITY

* Only Admin role can use !dmall * Role permissions checked via Discord ID * No in-game admin commands required * Prevent command abuse / spam spam-lock after 1 use per 10 sec

---

πŸš€ BEHAVIOR GOAL

* Minecraft server should feel fully controlled from Discord * Players do not need in-game commands * Discord acts as full control panel * DM system is optional opt-in OR role-based

---

🎨 OPTIONAL UPGRADES (if supported)

* Embed-style DM messages * Giveaway system (Nitro / rewards) * SMP event broadcasting system * Reaction role notification system

Kodari AI
KodariMay 2 at 2:38 pm 16,321 (v2)

I’ll create a Discord DM Bridge plugin that connects Minecraft with Discord, enabling a full DM system with role-based targeting and opt-in subscriptions.

DiscordDMBridge
A PaperMC plugin that bridges Minecraft with Discord using JDA. Enables Discord-controlled messaging with a comprehensive DM system supporting role-based targeting, opt-in subscriptions, and admin broadcasts. Features rate-limited DM delivery, permission-based commands, and optional in-game integration for alerts and player lists. All control happens through Discord commands.

Now I’ll create the remaining core files for the Discord bot system, DM management, and Minecraft integration.


βœ… DiscordDMBridge plugin created successfully!

Core Features Implemented:

  • Discord bot connection with JDA (auto-reconnect support)

  • DM system with !dmrole, !dmall, !subscribe, !unsubscribe

  • 2-second rate limiting between DMs

  • Failed DM handling (skips users with closed DMs)

  • Admin-only !dmall command with role verification

  • Spam prevention (10-second cooldown per command)

  • Minecraft integration: !say, !alert, !list

  • Full logging for DM success/failure tracking

Configuration: Edit config.yml with your bot token, guild ID, and admin role ID, then restart the server.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
Code
10 574
src/main/java/com/discorddmbridge/DiscordDMBridge.java
package com.discorddmbridge;

import com.discorddmbridge.config.ConfigManager;
import com.discorddmbridge.discord.BotManager;
import com.discorddmbridge.discord.DMManager;
import com.discorddmbridge.minecraft.MinecraftBridge;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class DiscordDMBridge extends JavaPlugin {
    private ConfigManager configManager;
    private BotManager botManager;
    private DMManager dmManager;
    private MinecraftBridge minecraftBridge;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.configManager = new ConfigManager(this);
        this.dmManager = new DMManager(this);
        this.minecraftBridge = new MinecraftBridge(this);
        this.botManager = new BotManager(this);
        
        this.botManager.connect();
        
        getLogger().info("DiscordDMBridge has been enabled!");
    }

    @Override
    public void onDisable() {
        if (this.botManager != null) {
            this.botManager.shutdown();
        }
        
        getLogger().info("DiscordDMBridge has been disabled!");
    }
}