Ghost8111

Give me a minecraft plugins for 1.21.4 that use discordsrv plugin along with it and if someone send their name in a specific channel of my discord server the bot will automatically add their name in whitelist but before whitelisting the bot should get a verification by my staff in discord by bot will react on that message with ✅ and ❌ and if my staff says ✅ then whitelist them if ❌ then don't also make it so only staff will react then it works not others

Kodari AI
KodariJan 18 at 2:22 pm 8,356 (v2)

I’ll create a Discord-integrated whitelist plugin for Minecraft 1.21.4 that works with DiscordSRV.

DiscordWhitelist
A Minecraft plugin that integrates with DiscordSRV to automate whitelist management through Discord. Players submit their Minecraft username in a designated Discord channel, which triggers a verification process where staff members can approve or deny the request using reaction emojis. Only designated staff can approve requests, ensuring controlled whitelist access.

All done! This plugin will:

✅ Listen to messages in your specified Discord channel ✅ Validate Minecraft usernames (3-16 chars, alphanumeric + underscore) ✅ Add reaction emojis (✅ and ❌) automatically ✅ Only allow staff with the specified role to approve/deny ✅ Remove non-staff reactions automatically ✅ Add to whitelist when staff clicks ✅ ✅ Reject request when staff clicks ❌ ✅ Prevent duplicates - checks if already whitelisted

Setup Instructions:

  1. Install DiscordSRV first

  2. Add this plugin to your server

  3. Start server to generate config.yml

  4. Edit config.yml and set:

    • discord.whitelist-channel-id - Right click your Discord channel → Copy ID

    • discord.staff-role-id - Right click staff role → Copy ID

  5. Run /dwl reload

Players just type their Minecraft username in the channel and staff approve/deny with reactions!

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
README.md
Code
10 593
src/main/java/com/discordwhitelist/DiscordWhitelist.java
package com.discordwhitelist;

import com.discordwhitelist.commands.WhitelistCommand;
import com.discordwhitelist.listeners.DiscordMessageListener;
import com.discordwhitelist.listeners.DiscordReactionListener;
import github.scarsz.discordsrv.DiscordSRV;
import github.scarsz.discordsrv.dependencies.jda.api.JDA;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class DiscordWhitelist extends JavaPlugin {
    
    private WhitelistManager whitelistManager;
    private ConfigManager configManager;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        if (!setupDiscordSRV()) {
            getLogger().severe("DiscordSRV not found! Disabling plugin...");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        
        configManager = new ConfigManager(this);
        whitelistManager = new WhitelistManager(this);
        
        registerListeners();
        registerCommands();
        
        getLogger().info("DiscordWhitelist has been enabled!");
    }
    
    @Override
    public void onDisable() {
        if (DiscordSRV.getPlugin() != null) {
            JDA jda = DiscordSRV.getPlugin().getJda();
            if (jda != null) {
                jda.removeEventListener(jda.getRegisteredListeners().toArray());
            }
        }
        getLogger().info("DiscordWhitelist has been disabled!");
    }
    
    private boolean setupDiscordSRV() {
        if (getServer().getPluginManager().getPlugin("DiscordSRV") == null) {
            return false;
        }
        
        DiscordSRV discordSRV = DiscordSRV.getPlugin();
        if (discordSRV == null) {
            return false;
        }
        
        Bukkit.getScheduler().runTaskLater(this, () -> {
            JDA jda = discordSRV.getJda();
            if (jda != null) {
                jda.addEventListener(new DiscordMessageListener(this));
                jda.addEventListener(new DiscordReactionListener(this));
                getLogger().info("Discord listeners registered successfully!");
            } else {
                getLogger().warning("JDA not ready yet, listeners will be registered when available.");
            }
        }, 20L);
        
        return true;
    }
    
    private void registerListeners() {
    }
    
    private void registerCommands() {
        WhitelistCommand command = new WhitelistCommand(this);
        getCommand("discordwhitelist").setExecutor(command);
        getCommand("discordwhitelist").setTabCompleter(command);
    }
    
    public void reload() {
        reloadConfig();
        configManager = new ConfigManager(this);
        getLogger().info("Configuration reloaded!");
    }
}