ibrahim_00123

12

Kodari AI
KodariJul 5 at 11:20 am 1

I’ll create a combat logging prevention plugin.

CombatLogger
A comprehensive combat logging prevention plugin that automatically tags players upon PvP engagement. Features include configurable combat duration, blocked commands during combat, teleport prevention, combat log punishments with customizable commands, visual indicators through titles and action bars, full message configuration, and PlaceholderAPI support. Includes /combatlog command with status check and reload functionality.</project_descriptionA combat logging prevention plugin that tags players in combat, prevents safe-disconnect, and punishes combat loggers.
CombatLogger
A combat logging prevention plugin for Minecraft servers. Automatically tags players when they engage in PvP, preventing them from logging out safely. Features include configurable combat duration, action bar combat timers, teleportation blocking during combat, command restrictions, and automatic punishment for players who disconnect while in combat. Includes a configurable message system and admin commands.
Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
9 335
src/main/java/com/combatlogger/CombatLogger.java
package com.combatlogger;

import com.combatlogger.commands.CombatCommand;
import com.combatlogger.listeners.CombatListener;
import com.combatlogger.managers.CombatManager;
import com.combatlogger.managers.ConfigManager;
import com.combatlogger.utils.MessageUtil;
import net.kyori.adventure.text.Component;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public class CombatLogger extends JavaPlugin {
    private CombatManager combatManager;
    private ConfigManager configManager;

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

        combatManager = new CombatManager(this);

        getServer().getPluginManager().registerEvents(new CombatListener(this), this);
        getCommand("combat").setExecutor(new CombatCommand(this));

        getServer().getScheduler().runTaskTimer(this, () -> {
            for (Player player : getServer().getOnlinePlayers()) {
                if (combatManager.isInCombat(player)) {
                    long seconds = combatManager.getRemainingSeconds(player);
                    String msg = configManager.getTaggedMessage().replace("%seconds%", String.valueOf(seconds));
                    player.sendActionBar(Component.text(MessageUtil.color(msg)));
                }
            }
        }, 0L, 20L);
    }

    public CombatManager getCombatManager() {
        return combatManager;
    }

    public ConfigManager getConfigManager() {
        return configManager;
    }
}