endixon

create antiexploit fixer plugin 1.21.11

Kodari AI
KodariJul 23 at 6:51 pm 24
AntiExploit
A comprehensive anti-exploit plugin for Minecraft 1.21.1 that patches common server vulnerabilities. Covers TNT/gravity block duplication via pistons, bedrock breaking exploits, nether roof access, illegal item stacks, over-leveled enchantments, book-crash attacks, inventory click spam, and falling block entity dupes. Every module is individually toggleable. Violations are logged to file and broadcast to admins in real time, with optional kick/ban actions per exploit type.

Plan:

  1. AntiExploitPlugin — main class, registers all components

  2. ConfigManager — typed wrappers around config.yml

  3. ViolationLogger — file + admin broadcast logging

  4. ExploitListener — piston dupes, bedrock, nether roof, enchants, books

  5. InventoryExploitListener — illegal stacks, click spam, crafting exploits

  6. AntiExploitCommand — /antiexploit reload|status|check <player>

Here’s a full breakdown of everything built:


🛡️ AntiExploit — 10 Protection Modules

Module
What it blocks
tnt-dupe
Pistons pushing/retracting TNT blocks
gravity-dupe
Duplicate
FallingBlock
entities from sticky piston retraction; double-land detection
bedrock-break
Any non-bypassed player breaking bedrock
nether-roof
Players moving above Y=127 in the Nether — teleports them back down
illegal-stacks
Items with
amount > maxStackSize
— clamped on click, pickup, and inventory open
illegal-enchants
Enchantment levels over vanilla max — stripped automatically
book-ban
Books exceeding page count, page length, or total character limits
inventory-spam
Inventory click rate limiting (default 20 clicks/sec window)
end-portal-exploit
Placing/breaking End Portal Frames in survival
update-suppression
Suspicious piston chains with ≥12 blocks + ≥4 redstone components

⚙️ Config highlights

  • Every module individually toggleable in config.yml

  • Per-module kick list (optional)

  • Logging to console, file (violations.log), and admin broadcast

  • antiexploit.bypass permission for trusted staff

📟 Commands

  • /antiexploit reload — hot-reload config

  • /antiexploit status — visual module dashboard

  • /antiexploit check <player> — inspect a player’s location, gamemode, illegal stacks

endixon

ok dodaj zabezpieczenia typu book exploit nbt itp

Kodari AI
KodariJul 23 at 7:24 pm 35

Got everything I need. I’ll:

  1. Create NBTExploitListener.java — sign exploit, anvil rename exploit, attribute flood, firework crash, command block removal, NBT size bomb, lore spam

  2. Patch ConfigManager.java — add 6 new module getters + settings

  3. Patch config.yml — add new module entries + config sections

  4. Patch AntiExploitPlugin.java — register the new listener

Done! Here’s what was added:


🆕 6 New Exploit Modules

Module
What it blocks
sign-exploit
Sign lines exceeding
max-line-length
(default 100 chars) — prevents crash/lag via oversized sign text packets
rename-exploit
Anvil renames longer than
max-name-length
(default 64 chars) — nullifies the result before it’s created
attribute-exploit
Items carrying more attribute modifiers than
max-per-item
(default 16) — all modifiers stripped on join
firework-exploit
Firework rockets with more effects than
max-effects
(default 4) — interaction cancelled before launch
commandblock-exploit
Non-creative players holding or logging in with command blocks — removed from inventory immediately
nbt-bomb
Items whose
serialised byte size
exceeds
max-item-bytes
(32 KB), or whose lore exceeds
max-lore-lines
/
max-lore-total-chars
— item removed from inventory

🔎 NBT Bomb specifics

  • Uses ItemStack.serializeAsBytes() — directly measures the raw NBT payload size, catches anything oversized regardless of how it was crafted (hacked clients, server-side commands, etc.)

  • Lore spam checked separately as a second pass (lore exploits show up before byte limits are hit)

  • Runs on join to catch items persisted to disk, and on anvil result to block crafting them

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
10 1,324
src/main/java/com/kodari/antiexploit/AntiExploitPlugin.java
package com.kodari.antiexploit;

import com.kodari.antiexploit.commands.AntiExploitCommand;
import com.kodari.antiexploit.config.ConfigManager;
import com.kodari.antiexploit.listeners.ExploitListener;
import com.kodari.antiexploit.listeners.InventoryExploitListener;
import com.kodari.antiexploit.listeners.NBTExploitListener;
import com.kodari.antiexploit.logging.ViolationLogger;
import org.bukkit.plugin.java.JavaPlugin;

public class AntiExploitPlugin extends JavaPlugin {

    private ConfigManager configManager;
    private ViolationLogger violationLogger;

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

        this.configManager = new ConfigManager(this);
        this.violationLogger = new ViolationLogger(this);

        getServer().getPluginManager().registerEvents(new ExploitListener(this), this);
        getServer().getPluginManager().registerEvents(new InventoryExploitListener(this), this);
        getServer().getPluginManager().registerEvents(new NBTExploitListener(this), this);

        AntiExploitCommand cmd = new AntiExploitCommand(this);
        getCommand("antiexploit").setExecutor(cmd);
        getCommand("antiexploit").setTabCompleter(cmd);

        getLogger().info("AntiExploit v" + getDescription().getVersion() + " enabled — "
                + configManager.getEnabledModuleCount() + " modules active.");
    }

    @Override
    public void onDisable() {
        if (violationLogger != null) {
            violationLogger.close();
        }
        getLogger().info("AntiExploit disabled.");
    }

    public ConfigManager cfg() {
        return configManager;
    }

    public ViolationLogger getViolationLogger() {
        return violationLogger;
    }
}