JeevanDC Yt

Hey built a plugin called JWhitelist which will whitelist users through discord upon sending their igns and whenever they sents whitelist the exact ign in game no bug or mistype by plugin in it and limit of every discord members whitelist per member whitelist every discord member can whitelist 1 time and can be configured by console config.yml and whenever whitelisted sent the ign and the users dc tag seperately saved in discord channel with id given and configured and added by config.yml of discord channel id<> and sent this message in that channel IGN: <IGN Given in dc and which is whitelisted> after that enter in next line Tag: <discord tag mentioned> and next line Ip: <their minecraft srv joining ip this will be edited after the user joins the srv> then another feature how many whitelisted players can join with another account with same ip limit <1 2>(if it's set1 or 3 etc if the already whitelisted user join from another id whitelisted but ip is same kick that user which ign was whitelisted after and remove whitelist and send logs in seperate channel configured from console config.yml with message sent IGN: <their minecraft name of 2nd ip joined> in next line IP: <THEIR IP> MATCHED WITH: <gives the another user whose ign matched like this user1, user2 in-game name> at last line -# Unwhitelisted cause matching same ip also don't unwhitelist those who have already registered but login in from other users account like id sharing also whoever gives their ign and if they are already whitelisted sent them dm or reply only shown to them or a message which will be deleted after some time This Username is already whitelisted and if someone tries to whitelist more than 1 or limit id same like which can be sent like just make configured from config.yml of already whitelisted message and max account reached message if instead of msg it's emoji just react the emoji to their message if it's message set in config.yml sent them message in dm or only shown to them and in reached whitelist limit react this emoji to their message ⛔ and saving every whitelisted user data in whitelist.yml and ingame commands or which can be used by console /JWhitelist reset (resets the every data of whitelisted users 0 whitelist and redoes everything like clearing their already whitelisted etc can be whitelisted again to limit and a dc can whitelist again just like starting and no restart needed or reload) /JWhitelist stop(stops doing whitelist and saving data) /JWhitelist start(starts doing whitelist and saving data again to the channels) also if a user is whitelisted after giving ign make it customizable from config.yml with reaction adding✅ or if the username doesn't match minecraft policy of names don't whitelist and sent message which can be seen by them or deleted later (your name doesn't matches Minecraft name policy) and bot token placing and channels I'd different for every of whitelist saving unwhitelist and ign giving and max ign per user and antiip like I have told up and no bugs like not matching ip and you Unwhitelisted them matching and correct and message customizable and /JWhitelist reload(reloads the config and no need to restart srv to change dc srv I'd bot token etc and srv id everything)

Kodari AI
KodariTue at 5:11 pm 5
JWhitelist
A Discord-integrated Minecraft whitelist plugin that automatically whitelists players when they send their in-game names in a configured Discord channel. Features per-member whitelist limits, anti-IP-sharing detection that unwhitelists accounts matching the same IP, customizable messages and reactions, configurable Discord channels for whitelist logs and unwhitelist notifications, data persistence in whitelist.yml, and console commands for reset, start, stop, and reload functionality.

I’ll build the Discord bot, persistent whitelist records, IP-limit enforcement, and live administration commands. IP addresses will be posted to the configured Discord channels, so those channels should be private.

Created JWhitelist with Discord IGN submissions, configurable limits and responses, whitelist logs, IP enforcement, persistent records, and /jwhitelist start|stop|reset|reload.

Configure config.yml, enable the bot’s Message Content Intent in Discord, and enable the Minecraft server whitelist. The first joining IP is retained for each account; later logins to that registered account are exempt from IP-limit removal. Reset removes only whitelist entries managed by JWhitelist.

JeevanDC Yt

Make when typed/JWhitelist show upcoming commands to type just like names shown but not name start stop reset reload and when reset don't remove old whitelisted igns just and when someone send the whitelisted ign it sends dm but it shall send a ❌ and delete all the messages after 5 seconds of sending and sent dm what was the problem and delete the igns and etc and make antiip work just when if someone tries to make alts and everything working and there were some errors in console idk w were they I can't find now it said couldn't found z like that also it dms but it would be better if it can sent msg in the channel were only he can see and like option dismiss message and a command /jjwarn <message type in game> sends warning to selected role I'd in dm to give them warning with players who have that specific role config.yml and sends done msg in Minecraft game for the executor only

Kodari AI
KodariTue at 5:44 pm 4
  1. Add /jwhitelist help and preserve existing whitelist entries on reset.

  2. Update Discord responses and message cleanup, and review IP enforcement.

  3. Add /jjwarn to DM members of a configured Discord role.

  • Added /jwhitelist help and tab completion. Reset now clears JWhitelist records but keeps Minecraft whitelist entries.

  • Submissions are deleted after five seconds. Already-whitelisted names get a ❌ reaction and a DM explaining why.

  • IP enforcement now removes only the newly joining, unregistered account; previously registered accounts remain exempt.

  • Added /jjwarn <message> to DM members of the configured discord.warning-role-id.

Enable both Message Content and Server Members intents for the bot, and give it permission to manage messages. Discord cannot make ordinary channel messages visible only to one person; that requires a slash-command interaction.

IP matching cannot distinguish alts from people sharing a connection. Reset also clears saved IP records. If the console error returns, send the full error and stack trace so I can identify it.

JeevanDC Yt

Hey in config.yml of console we can't set role I'd no area make like jjwarn role id- <id> and works after reload and etc and warm those in dm embed if possible in jjwarn to all those have that role

Kodari AI
KodariWed at 10:53 am 2

I’ll add a visible jjwarn.role-id setting, preserve any existing warning role, and send warnings as Discord embeds.

Added jjwarn.role-id to config.yml. Existing warning-role settings are preserved, and /jwhitelist reload applies changes.

/jjwarn <message> now sends an embed by DM to members with that role.

JeevanDC Yt

It's not getting downloaded

Kodari AI
KodariThu at 10:38 am 1

On desktop, click Compile in the top bar. On phone, tap ⋮ → Compile Project. Then:

  1. Click Compile in the window.

  2. Once it succeeds, click Download on the build.

If compilation fails, click Auto-fix in chat or Fix in the build window. If it succeeds but the download still doesn’t start, tell me what happens when you click Download.

JeevanDC Yt

Make the plugin less size with not removing anything bcz it's 20mb

Kodari AI
KodariThu at 10:41 am 1

JDA, the library powering the Discord bot, is the main likely contributor to the jar size. I can’t safely reduce it from the project files alone: the packaging system isn’t visible, and removing dependencies blindly could break Discord features.

Please upload the 20 MB jar so I can check what’s inside and identify what can be removed without losing functionality.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
settings.gradle
Code
6 508
src/main/java/com/kodari/jwhitelist/JWhitelist.java
package com.kodari.jwhitelist;

import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.Role;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import net.dv8tion.jda.api.requests.GatewayIntent;
import net.dv8tion.jda.api.entities.emoji.Emoji;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class JWhitelist extends JavaPlugin implements Listener {
    private static final Pattern NAME = Pattern.compile("^[A-Za-z0-9_]{3,16}$");
    private static final Pattern MOJANG_ID = Pattern.compile("\"id\"\\s*:\\s*\"([0-9a-fA-F]{32})\"");
    private static final Pattern MOJANG_NAME = Pattern.compile("\"name\"\\s*:\\s*\"([A-Za-z0-9_]{3,16})\"");
    private File dataFile;
    private YamlConfiguration data;
    private volatile JDA bot;
    private volatile boolean running = true;
    private volatile long generation;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        ensureWarningRoleConfig();
        dataFile = new File(getDataFolder(), "whitelist.yml");
        data = YamlConfiguration.loadConfiguration(dataFile);
        running = data.getBoolean("running", true);
        Bukkit.getPluginManager().registerEvents(this, this);
        connectBot();
    }

    @Override
    public void onDisable() {
        generation++;
        if (bot != null) bot.shutdownNow();
        saveData();
    }

    private void saveData() {
        data.set("running", running);
        try {
            data.save(dataFile);
        } catch (IOException e) {
            getLogger().severe("Could not save whitelist.yml: " + e.getMessage());
        }
    }

    private void ensureWarningRoleConfig() {
        if (!getConfig().isSet("jjwarn.role-id")) {
            String previousRole = getConfig().getString("discord.warning-role-id", "WARNING_ROLE_ID");
            getConfig().set("jjwarn.role-id", previousRole);
            saveConfig();
        }
    }

    private void connectBot() {
        long currentGeneration = ++generation;
        if (bot != null) {
            bot.shutdownNow();
            bot = null;
        }
        String token = getConfig().getString("discord.token", "");
        String guild = getConfig().getString("discord.server-id", "");
        String channel = getConfig().getString("discord.submission-channel-id", "");
        if (token.isEmpty() || token.equals("YOUR_BOT_TOKEN") || !guild.matches("\\d+") || !channel.matches("\\d+")) {
            getLogger().warning("Configure the Discord token, server ID and submission channel ID, then run /jwhitelist reload.");
            return;
        }
        try {
            bot = JDABuilder.createDefault(token)
                    .enableIntents(GatewayIntent.GUILD_MESSAGES, GatewayIntent.MESSAGE_CONTENT, GatewayIntent.GUILD_MEMBERS)
                    .addEventListeners(new DiscordListener(currentGeneration, guild, channel))
                    .build();
        } catch (Exception e) {
            getLogger().severe("Could not start Discord bot: " + e.getMessage());
        }
    }

    private class DiscordListener extends ListenerAdapter {
        private final long listenerGeneration;
        private final String guildId;
        private final String channelId;

        DiscordListener(long listenerGeneration, String guildId, String channelId) {
            this.listenerGeneration = listenerGeneration;
            this.guildId = guildId;
            this.channelId = channelId;
        }

        @Override
        public void onMessageReceived(MessageReceivedEvent event) {
            if (event.getAuthor().isBot() || !event.isFromGuild() || listenerGeneration != generation
                    || !event.getGuild().getId().equals(guildId) || !event.getChannel().getId().equals(channelId)) return;
            Message message = event.getMessage();
            User user = event.getAuthor();
            String name = message.getContentRaw().trim();
            message.delete().queueAfter(5, TimeUnit.SECONDS, null,
                    error -> getLogger().warning("Could not delete Discord submission: " + error.getMessage()));
            if (!running) {
                respond(message, user, "stopped");
                return;
            }
            if (!NAME.matcher(name).matches()) {
                respond(message, user, "invalid-name");
                return;
            }
            Bukkit.getScheduler().runTask(JWhitelist.this, () -> {
                if (listenerGeneration != generation) return;
                if (!running) {
                    respond(message, user, "stopped");
                    return;
                }
                if (findByName(name) != null || Bukkit.getOfflinePlayer(name).isWhitelisted()) {
                    respond(message, user, "already-whitelisted");
                    return;
                }
                if (countForUser(user.getId()) >= userLimit()) {
                    respond(message, user, "limit-reached");
                    return;
                }
                if (!Bukkit.getOnlineMode()) {
                    completeSubmission(message, user, name, Bukkit.getOfflinePlayer(name).getUniqueId(), listenerGeneration);
                } else {
                    CompletableFuture.supplyAsync(() -> lookupAccount(name)).thenAccept(result -> {
                        if (!isEnabled()) return;
                        Bukkit.getScheduler().runTask(JWhitelist.this, () -> {
                            if (listenerGeneration != generation) return;
                            if (result == null) respond(message, user, "lookup-failed");
                            else if (result.isEmpty()) respond(message, user, "invalid-name");
                            else completeSubmission(message, user, name, UUID.fromString(result), listenerGeneration);
                        });
                    });
                }
            });
        }
    }

    // Empty means a nonexistent or differently capitalized account; null means a lookup failure.
    private String lookupAccount(String name) {
        HttpURLConnection connection = null;
        try {
            connection = (HttpURLConnection) new URL("https://api.mojang.com/users/profiles/minecraft/" + name).openConnection();
            connection.setConnectTimeout(5000);
            connection.setReadTimeout(5000);
            int status = connection.getResponseCode();
            if (status == 204 || status == 404) return "";
            if (status != 200) return null;
            String json;
            try (java.io.InputStream in = connection.getInputStream()) {
                json = new String(in.readAllBytes(), StandardCharsets.UTF_8);
            }
            Matcher id = MOJANG_ID.matcher(json);
            Matcher actualName = MOJANG_NAME.matcher(json);
            if (!id.find() || !actualName.find()) return null;
            if (!actualName.group(1).equals(name)) return "";
            String raw = id.group(1);
            return raw.substring(0, 8) + "-" + raw.substring(8, 12) + "-" + raw.substring(12, 16) + "-" + raw.substring(16, 20) + "-" + raw.substring(20);
        } catch (IOException e) {
            return null;
        } finally {
            if (connection != null) connection.disconnect();
        }
    }

    private void completeSubmission(Message message, User user, String name, UUID uuid, long requestGeneration) {
        if (requestGeneration != generation) return;