don hobhai
📎 1 file 2,093 chars
📄
pasted-code-1791012301851.txt
txt 35 lines
▶
Create a complete Minecraft Paper 1.21.11 plugin named **VoidSMPBot** using Java 21 and Gradle.

The plugin should integrate a Discord bot using JDA and include the following features:

1. **`/status`** — Display Minecraft server status, IP, online players, maximum players, version, and ping in a Discord embed. Automatically update the existing status message instead of creating duplicates.

2. **`/linkaccount `** — Allow players to link their Minecraft accounts with Discord using secure, temporary verification codes. Store linked accounts in an SQLite database.

3. **Automatic Discord Role Assignment** — Assign a configurable Discord role after successful account linking.

4. **Minecraft-to-Discord Chat** — Send Minecraft player messages to a configurable Discord channel.

5. **Discord-to-Minecraft Chat** — Broadcast messages from a configured Discord channel to Minecraft players.

6. **`/announce `** — Allow authorized Discord staff to broadcast announcements to Minecraft.

7. **`/dc`** — Display the official VoidSMP Discord invitation in Minecraft chat.

**Server Details:**
- Server name: VoidSMP
- Minecraft version: Paper 1.21.11
- Java version: 21
- Server IP: `voidsmp.cyou`
- Port: `25586`
- Database: SQLite
- Discord integration: JDA
- Build system: Gradle

Use `config.yml` for the Discord bot token, guild ID, channel IDs, role IDs, update intervals, verification-code expiration, and other configurable settings. Never hardcode the bot token.

Create a complete, modular, functional project with all Java classes, `plugin.yml`, `config.yml`, Gradle files, README, and a GitHub Actions workflow that builds the plugin and uploads the JAR artifact.

Ensure compatibility with Paper 1.21.11 and Java 21. Handle errors, database operations, Discord API requests, plugin startup, and shutdown safely. Avoid blocking the Minecraft main thread.

**Generate all required source files with complete implementations. Ensure the entire project compiles successfully and the final JAR can be installed directly on my server.**
Kodari AI
KodariOct 3 at 7:39 am 1
VoidSMPBot
A comprehensive Minecraft Paper plugin integrating a Discord bot via JDA. Features include a /status command displaying server info in an auto-updating Discord embed, secure /linkaccount system with temporary verification codes stored in SQLite, automatic Discord role assignment post-linking, bidirectional Minecraft-Discord chat relay, /announce command for staff broadcasts, and /dc command showing the Discord invite. All settings configurable via config.yml, with async operations, safe shutdown handling, Gradle build system, and GitHub Actions CI workflow.
  1. Set up the Java 21 Gradle build, Paper plugin metadata, runtime dependencies, and CI artifact workflow.

  2. Implement SQLite account linking, temporary verification codes, Minecraft commands, and chat relay.

  3. Add the JDA bot with guild slash commands, role assignment, server status/ping updates, and setup documentation.

Created the VoidSMPBot project with the Java 21 Gradle build, Paper plugin metadata, configuration, and GitHub Actions artifact workflow.

The plugin includes Discord slash commands for /status, /linkaccount, and staff-only /announce; Minecraft /linkaccount code generation and /dc; SQLite-backed account links and role assignment; and chat relay in both directions. Status updates edit the saved Discord message and include a Minecraft server-list ping.

Set the bot token and Discord IDs in plugins/VoidSMPBot/config.yml. Build with gradle build; the JAR is written to build/libs/. The build was not run here.

don hobhai

not works in 1.21.11

Kodari AI
KodariOct 3 at 7:54 am 1

Added Paper’s libraries entries for JDA and SQLite. The Gradle JAR doesn’t bundle implementation dependencies, so Paper now downloads them when loading the plugin. The existing api-version: '1.21' is appropriate for Paper 1.21.11.

If it still fails, send the server console error from plugin startup so I can target the specific issue.

don hobhai

[03:56:36 ERROR]: [VoidSMPBot] VoidSMPBot could not finish starting. Disabling the plugin. java.lang.IllegalStateException: Set discord.token in config.yml before starting the bot. at VoidSMPBot-1.0.0.jar//com.voidsmpbot.discord.DiscordBotService.start(DiscordBotService.java:61) ~[?:?] at VoidSMPBot-1.0.0.jar//com.voidsmpbot.VoidSMPBotPlugin.lambda$onEnable$4(VoidSMPBotPlugin.java:55) ~[?:?] at java.base/java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:787) ~[?:?] at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?] at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?] [03:56:36 INFO]: Running delayed init tasks [03:56:36 INFO]: [VoidSMPBot] Disabling VoidSMPBot v1.0.0

Kodari AI
KodariOct 3 at 7:57 am 1

This isn’t a Paper 1.21.11 compatibility error. The plugin is stopping because the default config still has a placeholder token:

YAML
discord:
  token: "PUT_YOUR_BOT_TOKEN_HERE"

On the server, edit plugins/VoidSMPBot/config.yml and replace it with your bot’s token from the Discord Developer Portal, keeping the quotes. Save the file and restart the server. Don’t post or share the token.

don hobhai
📎 1 file 3,093 chars
📄
pasted-code-1791014580510.txt
txt 43 lines
▶
 An unexpected error occurred trying to execute that command
[04:02:26 WARN]: *************************************************************************************
>....
[04:02:26 WARN]: You are running the latest build for your Minecraft version (1.21.11)
>....
[04:02:26 WARN]: However, you are 4 release(s) behind the latest stable release (26.2)!
>....
[04:02:26 WARN]: It is recommended that you update as soon as possible
>....
[04:02:26 WARN]: https://papermc.io/downloads/paper
>....
[04:02:26 WARN]: *************************************************************************************
>....
[04:02:27 ERROR]: [VoidSMPBot] [STDERR] SLF4J(W): No SLF4J providers were found.
>....
[04:02:27 WARN]: Nag author(s): '[VoidSMP]' of 'VoidSMPBot v1.0.0' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).
>....
[04:02:27 ERROR]: [VoidSMPBot] [STDERR] SLF4J(W): Defaulting to no-operation (NOP) logger implementation
>....
[04:02:27 ERROR]: [VoidSMPBot] [STDERR] SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
>....
[04:02:28 WARN]: 2026-10-03 04:02:28 [JDA] [INFO] Login Successful!
>....
[04:02:29 WARN]: 2026-10-03 04:02:29 [WebSocketClient] [INFO] Connected to WebSocket
>....
[04:02:29 WARN]: 2026-10-03 04:02:29 [WebSocketClient] [ERROR] WebSocket connection was closed and cannot be recovered due to identification issues
>....
[04:02:29 WARN]: CloseCode[DISALLOWED_INTENTS](code=4014, meaning=Disallowed intents. Your bot might not be eligible to request a privileged intent such as GUILD_PRESENCES, MESSAGE_CONTENT, or GUILD_MEMBERS.)
>....
[04:02:29 ERROR]: [VoidSMPBot] VoidSMPBot could not finish starting. Disabling the plugin.
java.lang.IllegalStateException: Was shutdown trying to await status.
Reason: You tried turning on an intent you aren't allowed to use. For more information check https://jda.wiki/using-jda/troubleshooting/#im-getting-closecode4014-disallowed-intents
	at VoidSMPBot-1.0.0.jar//com.voidsmpbot.libs.net.dv8tion.jda.internal.JDAImpl.awaitStatus(JDAImpl.java:520) ~[?:?]
	at VoidSMPBot-1.0.0.jar//com.voidsmpbot.libs.net.dv8tion.jda.api.JDA.awaitStatus(JDA.java:338) ~[?:?]
	at VoidSMPBot-1.0.0.jar//com.voidsmpbot.libs.net.dv8tion.jda.api.JDA.awaitReady(JDA.java:388) ~[?:?]
	at VoidSMPBot-1.0.0.jar//com.voidsmpbot.discord.DiscordBotService.start(DiscordBotService.java:68) ~[?:?]
	at VoidSMPBot-1.0.0.jar//com.voidsmpbot.VoidSMPBotPlugin.lambda$onEnable$4(VoidSMPBotPlugin.java:55) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:787) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
	at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
[04:02:29 INFO]: [VoidSMPBot] Disabling VoidSMPBot v1.0.0
Kodari AI
KodariOct 3 at 8:04 am 1

The startup failure is Discord rejecting a privileged Gateway Intent, not a Paper 1.21.11 issue. I removed the unnecessary GUILD_MEMBERS intent; account role assignment uses Discord’s API and doesn’t require it.

To keep Discord-to-Minecraft chat working, enable Message Content Intent in the Discord Developer Portal: Application → Bot → Privileged Gateway Intents. Then rebuild the plugin and replace the JAR on your server. The SLF4J warnings are unrelated to this startup failure.

don hobhai

wht now i do just restart server and it fix or redownload plugine

Kodari AI
KodariOct 3 at 8:05 am 1

A restart alone won’t apply the code change. Enable Message Content Intent in your Discord Developer Portal, then download the updated VoidSMPBot JAR and replace the old JAR in plugins/. Start the server again.

don hobhai

wht is guild id in config

Kodari AI
KodariOct 3 at 8:11 am 1

The guild ID is your Discord server’s unique ID.

To copy it: enable Developer Mode in Discord under User Settings → Advanced, then right-click your server’s icon/name and choose Copy Server ID. Put that ID in the guild-id field in plugins/VoidSMPBot/config.yml. Make sure the bot has been invited to that server, then restart the server.

don hobhai

wht this status-message-id: "" roles: linked: "" staff: - ""

Kodari AI
KodariOct 3 at 8:14 am 1
  • status-message-id: "" is the Discord message ID for the server status embed. Leave it blank initially if the plugin creates the message for you; once created, the ID lets the plugin update that same message instead of posting duplicates.

  • roles.linked: "" is the Discord role ID to give members after they link their Minecraft account. Leave it blank to disable that role assignment.

  • roles.staff: - "" is a list of Discord role IDs allowed to use /announce. Replace the blank entry with your staff role ID, or leave the list empty if you don’t want role-based staff access.

To copy a role or message ID, enable Developer Mode in Discord’s User Settings → Advanced, then right-click the role or message and select Copy ID.

don hobhai

why i use /status or /announce it say application did not response

Kodari AI
KodariOct 3 at 8:23 am 1
  • Acknowledge /announce immediately so Discord’s interaction deadline isn’t missed.

  • Send the announcement result through the deferred interaction and log failed responses.

  • Keep /status deferred and add logging if Discord rejects its reply.

Discord requires slash commands to be acknowledged quickly. /announce was replying only after scheduling its Minecraft broadcast, so it could time out. I changed it to acknowledge immediately. /status already deferred its reply; I added error handling so status failures are logged and should return an error message instead of leaving the interaction unanswered.

Rebuild/download the updated JAR, replace the old one in plugins/, and restart the server. If either command still fails, send the console error produced when you run it.

don hobhai

i add role id of mod in last one not this new one so now it works?

Kodari AI
KodariOct 3 at 8:26 am 1

The roles.staff setting is in config.yml, so adding your mod role ID there should still apply after you replace the JAR—your existing config normally stays in place.

That role grants permission to use /announce; it won’t fix “Application did not respond” by itself. For the timeout fix, install the updated JAR and restart the server. Make sure your Discord account has that role, and enter its ID under roles.staff.

don hobhai

not work again and status and chat id i put in config but not msg there

Kodari AI
KodariOct 3 at 8:59 am 1
  1. Find why /announce and /status still time out.

  2. Trace why configured status/chat channels aren’t receiving messages.The IDs are for text channels, and each is used differently:

YAML
discord:
  channels:
    status: "STATUS_CHANNEL_ID"
    chat: "CHAT_CHANNEL_ID"
  status-message-id: ""
  • channels.status: where the bot creates or updates its status post. Leave status-message-id blank the first time; the bot saves the created message ID itself. If you entered an old or incorrect message ID, blank it and restart.

  • channels.chat: where Minecraft player chat is forwarded to Discord. It won’t post just because you configured the ID; send a message in Minecraft to test it.

  • After changing config, restart the server. The bot needs permission to view and send messages in both channels; the status channel also needs Embed Links permission.

For /announce, the staff role ID only controls who’s allowed to use the command; it doesn’t fix a timeout. The current source acknowledges /status and /announce before doing their work, so if Discord still says “Application did not respond,” make sure the server is running the rebuilt JAR. If it is, send the console lines around the command attempt and the relevant config keys with the token removed.

don hobhai

generate new my fixing all bugs last time im saying you

Kodari AI
KodariOct 3 at 9:10 am 1
  1. Trace the Discord slash-command, status-post, and Minecraft-chat flows against the current config.

  2. Fix the causes of command timeouts and missing channel messages, then summarize the exact config and rebuild steps.

Updated the plugin source to address the issues we could confirm:

  • A missing Message Content Intent permission will no longer prevent the whole plugin from starting. Discord-to-Minecraft chat relay is now optional; the new config setting defaults to off.

  • A missing or inaccessible status/chat channel now produces a console warning. If the saved status message was deleted, the plugin will clear its ID and create a replacement.

  • If roles.staff is empty, /announce now tells you it isn’t configured, and the console warns at startup.

Rebuild the plugin, replace the old JAR, and restart the server. In your existing config, add message-content-intent: false under discord: if it isn’t there already. To relay Discord chat into Minecraft, enable Message Content Intent in the Discord Developer Portal, set that config value to true, and restart.

The /status and /announce handlers already acknowledge commands in the source. If either still says “Application did not respond” with the rebuilt JAR, send the new console error around the command attempt; that exact failure wasn’t identifiable from the source alone.

Kodari can make mistakes. Review important code before using.
Files
.github
src
build.gradle
manifest.kod
README.md
settings.gradle
Code
14 1,052
src/main/java/com/voidsmpbot/VoidSMPBotPlugin.java
package com.voidsmpbot;

import com.voidsmpbot.database.Database;
import com.voidsmpbot.discord.DiscordBotService;
import com.voidsmpbot.link.LinkService;
import com.voidsmpbot.status.StatusService;
import com.voidsmpbot.web.MinecraftChatListener;
import com.voidsmpbot.web.MinecraftCommands;
import java.nio.file.Path;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public final class VoidSMPBotPlugin extends JavaPlugin {
    private ExecutorService databaseExecutor;
    private ExecutorService workerExecutor;
    private ExecutorService startupExecutor;
    private Database database;
    private LinkService linkService;
    private DiscordBotService discordBotService;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        databaseExecutor = Executors.newSingleThreadExecutor(runnable -> new Thread(runnable, "VoidSMPBot-SQLite"));
        workerExecutor = Executors.newFixedThreadPool(2, runnable -> new Thread(runnable, "VoidSMPBot-Worker"));
        startupExecutor = Executors.newSingleThreadExecutor(runnable -> new Thread(runnable, "VoidSMPBot-Startup"));

        String databaseFile = getConfig().getString("storage.database-file", "linked-accounts.sqlite");
        Path databasePath = getDataFolder().toPath().resolve(databaseFile);
        database = new Database(databasePath);
        long expirationSeconds = getConfig().getLong("account-link.code-expiration-seconds", 300L);
        linkService = new LinkService(database, databaseExecutor, expirationSeconds);

        StatusService statusService = new StatusService(this, workerExecutor);
        discordBotService = new DiscordBotService(this, linkService, statusService);

        Bukkit.getPluginManager().registerEvents(new MinecraftChatListener(discordBotService), this);
        getCommand("linkaccount").setExecutor(new MinecraftCommands(this, linkService));
        getCommand("dc").setExecutor(new MinecraftCommands(this, linkService));

        CompletableFuture.runAsync(() -> {
            try {
                database.initialize();
            } catch (Exception exception) {
                throw new CompletionException(exception);
            }
        }, databaseExecutor).thenRunAsync(() -> {
            try {
                discordBotService.start();
            } catch (InterruptedException exception) {
                Thread.currentThread().interrupt();
                throw new CompletionException(exception);
            }
        }, startupExecutor).exceptionally(error -> {
            Throwable cause = error instanceof CompletionException && error.getCause() != null
                    ? error.getCause() : error;
            getLogger().log(Level.SEVERE, "VoidSMPBot could not finish starting. Disabling the plugin.", cause);
            if (isEnabled()) {
                Bukkit.getScheduler().runTask(this, () -> Bukkit.getPluginManager().disablePlugin(this));
            }
            return null;
        });
    }

    @Override
    public void onDisable() {
        if (discordBotService != null) {
            discordBotService.shutdown();
        }
        if (startupExecutor != null) {
            startupExecutor.shutdownNow();
        }
        if (workerExecutor != null) {
            workerExecutor.shutdownNow();
        }
        if (databaseExecutor != null) {
            databaseExecutor.execute(() -> {
                try {
                    database.close();
                } catch (Exception exception) {
                    getLogger().log(Level.WARNING, "Could not close the account database cleanly.", exception);
                }
            });
            databaseExecutor.shutdown();
        }
    }
}