R

Develop a lightweight anti-Litematic plugin for Minecraft version 1.21.1 that automatically detects the presence of the Litematic mod in a player's client. If detected, the plugin should kick the player every 10 seconds until the mod is removed, with configurable options for the kick message and detection intervals. Ensure the plugin is optimized for minimal server impact and includes permission settings for staff oversight.

Kodari AI
KodariMay 12 at 4:53 pm 4,357 (v2)
AntiLitematic
A lightweight anti-cheat plugin that detects the Litematic mod on player clients via channel registration. When detected, the player is kicked immediately and re-kicked every 10 seconds if they reconnect with the mod still present. Features a configurable kick message and detection interval, a bypass permission for staff, and reload command support. Optimized for minimal server impact using only event listeners and a single repeating task.

Planning class structure:

  • AntiLitematic — main plugin class, registers events/commands, runs repeating task

  • DetectionListener — listens for PlayerRegisterChannelEvent and PlayerLoginEvent to flag players

  • KickTask — repeating BukkitRunnable that kicks flagged players on interval

  • ConfigManager — wraps config.yml values

  • CommandHandler — handles /antilitematic reload

No bStats needed here. I’ll proceed with the clean structure.

AntiLitematic
A lightweight anti-cheat plugin that detects the Litematic mod on player clients via channel registration. When detected, the player is kicked immediately and re-kicked every 10 seconds if they reconnect with the mod still present. Features a configurable kick message and detection interval, a bypass permission for staff, and reload command support. Optimized for minimal server impact using only event listeners and a single repeating task.

The plugin is complete. Here’s a summary of how it works:

  • Detection — DetectionListener listens for PlayerRegisterChannelEvent and checks for the litematica:have_litematica channel that the Litematic mod registers on join. Players with antilitematic.bypass are ignored.

  • Immediate kick — On detection, AntiLitematic#kickPlayer() is called instantly.

  • Repeating task — KickTask runs every kick-interval seconds (default 10s), re-kicking any online flagged player who still has the Litematic channel registered. If the mod is gone, the flag is cleared automatically.

  • Admin notifications — Broadcasts a configurable message to all online players with antilitematic.admin and logs to console.

  • Reload command — /antilitematic reload reloads config.yml and restarts the kick task with the new interval.

R

Do I need any dependency for it

Kodari AI
KodariMay 12 at 4:55 pm 1,744 (v2)

No external dependencies are needed. Here’s the full breakdown:


What the plugin uses

API
Source
How it’s provided
org.bukkit.*
Spigot/Paper server API
compileOnly
in
build.gradle
— the server itself provides it at runtime
org.bukkit.scheduler.BukkitRunnable
Spigot API
Same as above
org.bukkit.event.player.PlayerRegisterChannelEvent
Spigot API (1.13+)
Same as above
org.jetbrains.annotations.NotNull
JetBrains annotations
Bundled with the Spigot/Paper API jar automatically

Why no extra libraries are needed

  • No database — flagged players are stored in a plain in-memory HashSet<UUID>, which is wiped on restart by design.

  • No XSeries — the plugin never touches Material, Sound, Particle, or any version-specific Bukkit enum. It only uses players, channels, and the scheduler — all stable APIs since 1.13.

  • No Vault/LuckPerms — permissions are handled natively via Bukkit’s player.hasPermission().

  • No config library — Bukkit’s built-in FileConfiguration (getConfig(), saveDefaultConfig(), reloadConfig()) is sufficient for the simple flat config.


Your build.gradle only needs this

Groovy
dependencies {
    compileOnly "org.spigotmc:spigot-api:1.21.1-R0.1-SNAPSHOT"
}

That’s the only line required. No manifest.kod, no implementation blocks, no shadow/fat jar — just compile against the server API and drop the output jar into your plugins/ folder.

R

Can you do one thing the plugin is made by Gracc and make it support 1.21.11 to 1.19

Kodari AI
KodariMay 14 at 8:11 am 2,656 (v2)

Two changes needed:

  • plugin.yml: set author to Gracc and lower api-version to 1.19 (covers 1.19–1.21.1)

  • PlayerRegisterChannelEvent was added in 1.13 so no code changes are needed for version compatibility — all APIs used are stable across 1.19–1.21.1

Done. Two changes made to plugin.yml:

  • author → Gracc

  • api-version → 1.19 — this tells Spigot/Paper the plugin is compatible from 1.19 all the way up to 1.21.1. No code changes were needed since every API used (PlayerRegisterChannelEvent, BukkitRunnable, getListeningPluginChannels(), etc.) has been stable since 1.13.

R

Rename the plugin to Anti-Litematic 1.0.0

Kodari AI
KodariMay 14 at 8:12 am 3,375 (v2)

name in plugin.yml updated from AntiLitematic to Anti-Litematic — the version was already 1.0.0, so no further changes were needed.

Kodari can make mistakes. Review important code before using.
Files
src
Code
7 272
src/main/java/com/antilitematic/AntiLitematic.java
package com.antilitematic;

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;

public class AntiLitematic extends JavaPlugin {

    private ConfigManager configManager;
    private final Set<UUID> flaggedPlayers = Collections.synchronizedSet(new HashSet<>());
    private KickTask kickTask;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        configManager = new ConfigManager(this);

        getServer().getPluginManager().registerEvents(new DetectionListener(this), this);

        CommandHandler commandHandler = new CommandHandler(this);
        getCommand("antilitematic").setExecutor(commandHandler);

        startKickTask();

        getLogger().info("AntiLitematic enabled. Litematic detection is active.");
    }

    @Override
    public void onDisable() {
        if (kickTask != null && !kickTask.isCancelled()) {
            kickTask.cancel();
        }
        flaggedPlayers.clear();
        getLogger().info("AntiLitematic disabled.");
    }

    public void startKickTask() {
        kickTask = new KickTask(this);
        long intervalTicks = configManager.getKickInterval() * 20L;
        kickTask.runTaskTimer(this, intervalTicks, intervalTicks);
    }

    public void restartKickTask() {
        if (kickTask != null && !kickTask.isCancelled()) {
            kickTask.cancel();
        }
        startKickTask();
    }

    public void kickPlayer(Player player) {
        String message = configManager.getKickMessage();
        player.kickPlayer(message);

        if (configManager.isNotifyAdmins()) {
            String notify = configManager.getAdminNotifyMessage()
                    .replace("%player%", player.getName());
            Bukkit.getOnlinePlayers().stream()
                    .filter(p -> p.hasPermission("antilitematic.admin"))
                    .forEach(p -> p.sendMessage(notify));
            getLogger().info("[Detection] " + player.getName() + " was kicked for using Litematic.");
        }
    }

    public ConfigManager getConfigManager() {
        return configManager;
    }

    public Set<UUID> getFlaggedPlayers() {
        return flaggedPlayers;
    }
}