notshadow_999

Create a Minecraft Paper plugin called CombatLogGuard using Java and the Paper API.

Plugin Purpose:

Prevent players from escaping PvP fights by logging out during combat.

Core Mechanics:

  1. Combat Detection

* When Player A damages Player B, both players enter combat mode for 15 seconds. * If either player attacks again during combat, the combat timer resets to 15 seconds. * Display the remaining combat time using an ActionBar countdown.

  1. Combat Restrictions

While a player is in combat:

* Block commands like /spawn, /home, /warp, /tp, /tpa. * Send the message: "You cannot use commands while in combat!"

  1. Combat Logging System

If a player logs out while in combat:

* Spawn a zombie at the player's logout location. * The zombie must:

* Have the player's exact inventory * Have the player's armor * Have the player's current health * Have the custom name: "<PlayerName>'s Combat Body" * Be visible to players * The zombie should attack nearby players.

  1. Zombie Death

If the zombie is killed:

* Drop all items from the player's inventory and armor. * Mark the logged player as dead when they rejoin.

  1. Player Rejoin Handling

If the combat logged player rejoins while the zombie is still alive:

* Freeze the player (cannot move or interact). * Send the message: "Your combat body is still alive. If it dies, you will die."

  1. Zombie Timeout

If the zombie survives until the combat timer expires:

* Remove the zombie. * Allow the player to rejoin normally and survive.

  1. Commands

/combatlog reload – reload the plugin configuration /combatlog status – check if a player is currently in combat

  1. Permissions

combatlog.admin – access to admin commands combatlog.bypass – players with this permission do not trigger combat logging punishment

  1. Configuration File (config.yml)

Include configurable settings:

* combat-time: 15 * zombie-name: "%player%'s Combat Body" * block-commands: true * drop-inventory-on-death: true * freeze-player-on-join: true

  1. Technical Requirements

* Use Java with the Paper API * Compatible with Minecraft 1.20+ * Use event listeners for:

* PlayerDamage events * PlayerQuit events * PlayerJoin events * Prevent duplication glitches or item exploits.

Kodari AI
KodariMar 15 at 12:48 pm 21,625 (v2)

I’ll create a comprehensive combat logging prevention plugin for Paper 1.20+.

CombatLogGuard
A comprehensive PvP combat logging prevention system for Paper servers. When players engage in combat, they enter a 15-second combat mode with ActionBar countdown. Logging out during combat spawns an NPC zombie with the player's exact inventory, armor, and health that attacks nearby players. If the zombie dies, all items drop and the player dies on rejoin. Includes command blocking, player freezing, bypass permissions, and full configuration options.

Let me read the GUI documentation to understand the project structure, then create all necessary files.

Now I’ll create the complete plugin structure:

Perfect! I’ve created a complete combat logging prevention plugin with all the requested features:

Core Features Implemented:

  • ✅ 15-second combat mode with resetting timer on damage

  • ✅ ActionBar countdown display every second

  • ✅ Command blocking during combat (/spawn, /home, /tp, etc.)

  • ✅ Zombie spawning with player’s exact inventory, armor, and health

  • ✅ Custom zombie name with player’s name

  • ✅ Full item drops when zombie dies

  • ✅ Player death on rejoin if zombie was killed

  • ✅ Player freezing (no movement/interaction) when zombie is alive

  • ✅ Zombie removal after combat timer expires

  • ✅ /combatlog reload and /combatlog status commands

  • ✅ combatlog.admin and combatlog.bypass permissions

  • ✅ Fully configurable messages and settings

  • ✅ XSeries for cross-version entity spawning

  • ✅ Paper Adventure API for ActionBar and messages

Technical Highlights:

  • Uses Paper 1.20+ Adventure API for modern text components

  • XEntityType for cross-version zombie spawning

  • Proper event priority handling

  • Memory-efficient zombie tracking with cleanup

  • Prevents item duplication exploits

  • Supports projectile-based combat (arrows, etc.)

  • Thread-safe combat state management

The plugin is production-ready with comprehensive combat logging protection!

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
14 792
src/main/java/com/example/combatlogguard/CombatLogGuard.java
package com.example.combatlogguard;

import com.example.combatlogguard.command.CombatCommand;
import com.example.combatlogguard.listener.EntityListener;
import com.example.combatlogguard.listener.PlayerCombatListener;
import com.example.combatlogguard.listener.PlayerCommandListener;
import com.example.combatlogguard.listener.PlayerConnectionListener;
import com.example.combatlogguard.listener.PlayerMovementListener;
import com.example.combatlogguard.manager.CombatManager;
import com.example.combatlogguard.manager.CombatZombieManager;
import com.example.combatlogguard.task.ActionBarTask;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class CombatLogGuard extends JavaPlugin {
    private CombatManager combatManager;
    private CombatZombieManager zombieManager;
    private ActionBarTask actionBarTask;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.combatManager = new CombatManager(this);
        this.zombieManager = new CombatZombieManager(this);
        
        registerListeners();
        registerCommands();
        
        this.actionBarTask = new ActionBarTask(this);
        this.actionBarTask.runTaskTimer(this, 0L, 20L);
        
        getLogger().info("CombatLogGuard has been enabled!");
    }
    
    @Override
    public void onDisable() {
        if (actionBarTask != null) {
            actionBarTask.cancel();
        }
        if (zombieManager != null) {
            zombieManager.cleanup();
        }
        getLogger().info("CombatLogGuard has been disabled!");
    }
    
    private void registerListeners() {
        getServer().getPluginManager().registerEvents(new PlayerCombatListener(this), this);
        getServer().getPluginManager().registerEvents(new PlayerConnectionListener(this), this);
        getServer().getPluginManager().registerEvents(new PlayerCommandListener(this), this);
        getServer().getPluginManager().registerEvents(new EntityListener(this), this);
        getServer().getPluginManager().registerEvents(new PlayerMovementListener(this), this);
    }
    
    private void registerCommands() {
        getCommand("combatlog").setExecutor(new CombatCommand(this));
    }
    
    public void reload() {
        reloadConfig();
        getLogger().info("Configuration reloaded!");
    }
}