proplayeryt2025.

Make a simple anti spam plugin

Kodari AI
KodariJan 20 at 3:04 am 4,298 (v2)

I’ll create a simple anti-spam plugin that monitors chat messages and prevents spam.

AntiSpam
A lightweight anti-spam plugin that monitors player chat messages and prevents spam. Features configurable message limits, time windows, and automatic punishment (mute/kick/ban). Tracks message frequency per player and includes bypass permissions for staff. Admins can customize thresholds, cooldowns, and warning messages through the config file.

Created a simple anti-spam plugin with:

  • Configurable message limits and time windows

  • Progressive punishment system (warn → mute → kick → ban)

  • Cooldown system to prevent repeated spam

  • Bypass permission for staff

  • Reload command to update settings without restart

Configuration features:

  • max-messages: Number of messages allowed in time window

  • time-window-seconds: Time frame to count messages

  • cooldown-seconds: Forced delay after spam detection

  • Customizable thresholds for each punishment level

  • All messages are customizable with color codes

proplayeryt2025.

Add discord webhook for alerts

proplayeryt2025.

Optimize code

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
8 280
src/main/java/com/antispam/AntiSpam.java
package com.antispam;

import org.bukkit.plugin.java.JavaPlugin;

public class AntiSpam extends JavaPlugin {
    private SpamManager spamManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.spamManager = new SpamManager(this);
        
        getServer().getPluginManager().registerEvents(new ChatListener(this, spamManager), this);
        getCommand("antispam").setExecutor(new AntiSpamCommand(this));
        
        getLogger().info("AntiSpam has been enabled!");
    }

    @Override
    public void onDisable() {
        if (spamManager != null) {
            spamManager.clear();
        }
        getLogger().info("AntiSpam has been disabled!");
    }

    public void reload() {
        reloadConfig();
        spamManager.clear();
    }
}