Build a Velocity proxy plugin named ModBlocker (Java, Gradle). Target the Velocity API (not Paper/Bukkit). Use the Velocity @Plugin annotation with id "modblocker", name "ModBlocker", main class com.kodari.modblocker.ModBlocker. Do not add GUI, database, staff alerts, dashboards, or any command besides /modblocker reload. Keep dependencies minimal; Adventure is provided by Velocity, use it for components.

FEATURES (exactly two):

  1. Mod-Blocked: list of client mod identifiers. Match case-insensitively after trimming and lowercasing. No substring matching. Duplicates removed.
  2. Bypass: list of player usernames. Match case-insensitively. Bypassed players are never kicked by this plugin for a blocked-mod detection. Players cannot grant themselves bypass.

DETECTION (important, must be honest):

  • Velocity cannot see the full installed mod list by itself. Only a verified mod list counts. Do NOT kick based on the client brand string (vanilla/fabric/forge), on a name alone, or on behaviour.
  • Verified source: a companion client mod sends a plugin message on the channel "modblocker:mods" (namespace modblocker, key mods). Payload: UTF-8 string, mod IDs separated by commas or newlines. Register this channel with the proxy (MinecraftChannelIdentifier.create("modblocker","mods")), listen to PluginMessageEvent, and only accept messages whose source is a Player (ignore server-sourced messages, set ForwardResult.handled() so it is not forwarded to backend). Parse the IDs, normalize, and compare against Mod-Blocked.
  • Document in README that Freecam, Xray, KillAura, etc. are only enforced if the companion client sends those exact IDs. The plugin never claims to detect them itself.
  • If no mod report has arrived, the plugin does not kick and does not claim the player was checked. Log nothing per player at info level beyond a concise line on kick.
  • Never block the proxy event thread with waiting. Use no sleeps and no blocking calls. If you need a timeout to decide a player was not reported, schedule it with the proxy scheduler and do not block.
  • On a blocked-mod match for a non-bypassed player: player.disconnect(...) with the configured kick message. Kick is performed on the player's connection through the proxy, not on a backend.

CONFIG (plugin data folder, e.g. plugins/modblocker/): config.yml default content exactly:

code
# ModBlocker Configuration

Mod-Blocked:
  - Freecam
  - Xray
  - KillAura
  - Fly
  - Speed
  - Reach
  - NoFall
  - Jesus

Bypass:
  - PlayerName1
  - PlayerName2
  - PlayerName3
message.yml default content exactly:
code
Prefix: "&8[&cModBlocker&8] &r"

Kick-Message:
  - "&cBlocked mod detected!"
  - ""
  - "&7Detected mod: &e%mod%"
  - "&7Please remove this mod and reconnect."

  • Create defaults if missing (copy from the jar resources). Use a YAML library that is bundled or shaded in the jar; declare it in build.gradle and shade it, so the jar works on a stock Velocity server. Pick the smallest option.
  • Validate YAML and list values. Missing or empty lists are treated as empty. Non-string entries are ignored with a console warning. Trim blank entries.
  • Normalize names for matching only; keep original display names.
  • Kick message: join lines with newline, translate & codes with LegacyComponentSerializer.legacyAmpersand(), replace %mod% with the detected ID (the matching one from Mod-Blocked, displayed as written in config). If the message is missing or empty after parsing, use defaults above. Prepend Prefix to the first line only if it makes sense; apply the prefix consistently to the kick message. Never produce an empty kick.
  • Reload: /modblocker reload (permission modblocker.reload, console and op allowed). Load both files into a new immutable snapshot first; swap the active snapshot atomically (volatile reference) only if both parse successfully. On an invalid file, keep the last valid snapshot and log a concise error to console. Startup with invalid config: log error and use defaults.
  • On proxy shutdown: unregister the channel and clear state.

COMPATIBILITY: Target the current Velocity 3.x API. Set the Velocity API version in build.gradle to the latest stable 3.x release and state the Java version required. Do not claim tested versions of Minecraft; state in README the Minecraft protocol range is determined by the Velocity version you run.

DELIVERABLES: Java source, build.gradle(.kts), src/main/resources/velocity-plugin.json is not needed (annotation-based), README.md with: install steps (drop jar in proxy plugins/ folder, restart proxy), build steps (./gradlew build), configuration reference, the companion-mod channel contract above, and detection limitations. Done means: the code compiles with the Velocity API and the jar is produced by the build. Report the file list and any assumptions you made.

Kodari AI
KodariOct 13 at 4:38 pm 2
ModBlocker
A Velocity proxy plugin that kicks players when a verified companion client mod reports blocked mod IDs via the "modblocker:mods" plugin message channel. Features case-insensitive mod blocking lists, player bypass lists, atomic config reloads via /modblocker reload, and honest detection that only acts on verified mod reports, never on client brand or behavior alone.
  1. Set up a Java 17 Gradle project targeting Velocity 3.4.0 and bundle SnakeYAML in the plugin JAR.

  2. Implement verified mod-report handling, immutable reloadable configuration, and only /modblocker reload.

  3. Add the exact default resources and document installation, configuration, and detection limits.

Created the Velocity ModBlocker project with exact-match mod blocking, case-insensitive bypasses, verified player reports on modblocker:mods, atomic config reloads, and only /modblocker reload.

Files:

  • build.gradle, settings.gradle

  • src/main/java/com/kodari/modblocker/ModBlocker.java

  • src/main/resources/config.yml, src/main/resources/message.yml

  • README.md

The build targets Velocity 3.4.0 and Java 17, and bundles SnakeYAML in the plugin JAR. The README documents the client-report limitations and setup.

Assumption: Velocity has no built-in operator status for this permission check, so operators need modblocker.reload granted by the proxy’s permission provider. The plugin does not kick players who have not sent a mod report.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
README.md
settings.gradle
Code
6 368
src/main/java/com/kodari/modblocker/ModBlocker.java
package com.kodari.modblocker;

import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.command.SimpleCommand;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.connection.PluginMessageEvent;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.event.proxy.ProxyShutdownEvent;
import com.velocitypowered.api.plugin.Plugin;
import com.velocitypowered.api.plugin.annotation.DataDirectory;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ConsoleCommandSource;
import com.velocitypowered.api.proxy.ProxyServer;
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.slf4j.Logger;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.SafeConstructor;

import com.google.inject.Inject;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;

@Plugin(id = "modblocker", name = "ModBlocker", version = "1.0.0")
public final class ModBlocker {
    private static final MinecraftChannelIdentifier CHANNEL = MinecraftChannelIdentifier.create("modblocker", "mods");
    private static final LegacyComponentSerializer LEGACY = LegacyComponentSerializer.legacyAmpersand();
    private static final String CONFIG_FILE = "config.yml";
    private static final String MESSAGE_FILE = "message.yml";
    private static final String DEFAULT_PREFIX = "&8[&cModBlocker&8] &r";
    private static final List<String> DEFAULT_KICK_LINES = List.of(
            "&cBlocked mod detected!",
            "",
            "&7Detected mod: &e%mod%",
            "&7Please remove this mod and reconnect."
    );

    private final ProxyServer server;
    private final Logger logger;
    private final Path dataDirectory;
    private volatile Snapshot snapshot;

    @Inject
    public ModBlocker(ProxyServer server, Logger logger, @DataDirectory Path dataDirectory) {
        this.server = server;
        this.logger = logger;
        this.dataDirectory = dataDirectory;
    }

    @Subscribe
    public void onProxyInitialize(ProxyInitializeEvent event) {
        try {
            Files.createDirectories(dataDirectory);
            copyDefaultIfMissing(CONFIG_FILE);
            copyDefaultIfMissing(MESSAGE_FILE);
            snapshot = loadSnapshot(dataDirectory.resolve(CONFIG_FILE), dataDirectory.resolve(MESSAGE_FILE));
        } catch (Exception exception) {
            logger.error("Invalid ModBlocker configuration; using bundled defaults: {}", conciseError(exception));
            snapshot = loadBundledDefaults();
        }

        server.getChannelRegistrar().register(CHANNEL);
        server.getEventManager().register(this, this);
        registerCommand();
    }

    @Subscribe
    public void onPluginMessage(PluginMessageEvent event) {
        if (!CHANNEL.equals(event.getIdentifier())) {
            return;
        }

        event.setResult(PluginMessageEvent.ForwardResult.handled());
        if (!(event.getSource() instanceof Player player)) {
            return;
        }

        Snapshot current = snapshot;
        if (current == null || current.bypassedUsers().contains(normalize(player.getUsername()))) {
            return;
        }

        String payload = new String(event.getData(), StandardCharsets.UTF_8);
        for (String reportedId : payload.split("[,\\r\\n]")) {
            String blockedDisplayName = current.blockedMods().get(normalize(reportedId));
            if (blockedDisplayName == null) {
                continue;
            }

            player.disconnect(createKickMessage(current, blockedDisplayName));
            logger.info("Kicked {} for blocked mod {}", player.getUsername(), blockedDisplayName);
            return;
        }
    }

    @Subscribe
    public void onProxyShutdown(ProxyShutdownEvent event) {
        server.getChannelRegistrar().unregister(CHANNEL);
        snapshot = null;
    }

    private void registerCommand() {
        SimpleCommand command = new SimpleCommand() {
            @Override
            public void execute(Invocation invocation) {
                if (!hasPermission(invocation)) {
                    invocation.source().sendMessage(Component.text("You do not have permission to do that."));
                    return;
                }

                String[] arguments = invocation.arguments();
                if (arguments.length != 1 || !arguments[0].equalsIgnoreCase("reload")) {
                    invocation.source().sendMessage(Component.text("Usage: /modblocker reload"));
                    return;
                }

                try {
                    Snapshot replacement = loadSnapshot(dataDirectory.resolve(CONFIG_FILE), dataDirectory.resolve(MESSAGE_FILE));
                    snapshot = replacement;
                    invocation.source().sendMessage(Component.text("ModBlocker configuration reloaded."));
                } catch (Exception exception) {
                    logger.warn("ModBlocker reload failed; keeping the last valid configuration: {}", conciseError(exception));
                    invocation.source().sendMessage(Component.text("Reload failed; the previous configuration remains active."));
                }
            }

            @Override
            public boolean hasPermission(Invocation invocation) {
                CommandSource source = invocation.source();
                return source instanceof ConsoleCommandSource
                        || (source instanceof Player player && player.hasPermission("modblocker.reload"));
            }
        };

        server.getCommandManager().register(
                server.getCommandManager().metaBuilder("modblocker").plugin(this).build(),
                command
        );
    }

    private Component createKickMessage(Snapshot current, String detectedMod) {
        List<String> lines = new ArrayList<>(current.kickLines());
        for (int index = 0; index < lines.size(); index++) {
            lines.set(index, lines.get(index).replace("%mod%", detectedMod));
        }
        if (!current.prefix().isEmpty()) {
            lines.set(0, current.prefix() + lines.get(0));
        }
        String message = String.join("\n", lines);
        if (message.isBlank()) {
            message = String.join("\n", DEFAULT_KICK_LINES).replace("%mod%", detectedMod);
            if (!DEFAULT_PREFIX.isEmpty()) {
                message = DEFAULT_PREFIX + message;
            }
        }
        return LEGACY.deserialize(message);
    }

    private Snapshot loadSnapshot(Path configPath, Path messagePath) throws IOException {
        try (InputStream configInput = Files.newInputStream(configPath);
             InputStream messageInput = Files.newInputStream(messagePath)) {
            return parseSnapshot(configInput, messageInput, CONFIG_FILE, MESSAGE_FILE);
        }
    }

    private Snapshot loadBundledDefaults() {
        try (InputStream configInput = resource(CONFIG_FILE);
             InputStream messageInput = resource(MESSAGE_FILE)) {
            return parseSnapshot(configInput, messageInput, CONFIG_FILE, MESSAGE_FILE);
        } catch (IOException exception) {
            throw new IllegalStateException("Could not read bundled ModBlocker defaults", exception);
        }
    }

    private Snapshot parseSnapshot(InputStream configInput, InputStream messageInput, String configName, String messageName) {
        Map<?, ?> config = loadYaml(configInput, configName);
        Map<?, ?> messages = loadYaml(messageInput, messageName);

        Map<String, String> blockedMods = new LinkedHashMap<>();
        for (String displayName : readStringList(config, "Mod-Blocked", configName, false)) {
            blockedMods.putIfAbsent(normalize(displayName), displayName);
        }

        Set<String> bypassedUsers = new LinkedHashSet<>();
        for (String username : readStringList(config, "Bypass", configName, false)) {
            bypassedUsers.add(normalize(username));
        }

        Object prefixValue = messages.get("Prefix");