adriandev0062

A fancy combat plugin when they fight they are locked in the fight with a 20 seconds lock if they leave they die and their loot gets droppend instantly when they leave and they get a 10 minuts ban. with a message u left whiole in pvp

Kodari AI
KodariSep 8 at 6:53 pm 1
CombatLockdown
Forces players into PvP combat with a 20-second lock-on system. When combat initiates, both players are locked in battle and cannot leave the fight area. If a player attempts to escape, they instantly die, drop all loot, and receive a 10-minute ban with a message explaining they left while in PvP. Features automatic combat detection, lock enforcement, penalty execution, and ban management.
  1. Create the Gradle project and plugin metadata.

  2. Implement combat tagging with a 20-second refreshable timer.

  3. Punish combat logouts with immediate inventory drops, death, and a 10-minute ban.

  4. Add configurable messages and durations.

Created CombatLock plugin with:

  • 20-second combat tagging for melee and projectile PvP.

  • Combat timer refreshes whenever players fight.

  • Combat logout punishment:

    • Drops inventory immediately.

    • Kills the player.

    • Applies a 10-minute name ban.

    • Broadcasts that they left while in PvP.

  • Configurable combat duration, ban duration, and messages.

  • Gradle project setup with Spigot API.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
7 241
src/main/java/com/kodari/combatlock/CombatLockPlugin.java
package com.kodari.combatlock;

import org.bukkit.ChatColor;
import org.bukkit.plugin.java.JavaPlugin;

public final class CombatLockPlugin extends JavaPlugin {

    private CombatManager combatManager;

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

        combatManager = new CombatManager(this);
        getServer().getPluginManager().registerEvents(new CombatListener(combatManager), this);
    }

    @Override
    public void onDisable() {
        if (combatManager != null) {
            combatManager.shutdown();
        }
    }

    public String message(String path, String... replacements) {
        String message = getConfig().getString(path, path);
        for (int i = 0; i + 1 < replacements.length; i += 2) {
            message = message.replace(replacements[i], replacements[i + 1]);
        }
        return ChatColor.translateAlternateColorCodes('&', message);
    }
}