D

Act as a professional Java Developer specializing in Minecraft Spigot/Paper API.

Please create a complete Combat Log plugin with the following specifications:

  1. Combat Mechanics:

- Combat Duration: 15 seconds. - When a player hits or is hit by another player, the 15-second timer starts/resets.

  1. Action Bar Requirements (Above Inventory):

- During Combat: Display a red message: "§c§lYOU ARE IN COMBAT - DO NOT LEAVE! §e{timer}s" (Note: The {timer} must show the live countdown from 15 down to 1). - When Combat Ends: Display a green message for 3 seconds: "§a§lYou are not in combat now".

  1. Chat Message Requirements:

- When Combat Starts: Send "§cYou are in combat! Do not leave." - When Combat Ends: Send "§aYou are not in combat now."

  1. Combat Logging (Discord Proof):

- If a player leaves while the timer is active, send a log to this Webhook: https://discord.com/api/webhooks/1523678032978641079/JeXr08mcTJutA7dRan-wcRl9EIL0P1We9eBNPQxtddl3PgrLdJLRodGPicreoUyUDZHg - Discord Embed Details: - Title: 🔴 COMBAT LOG REPORT - Color: Red - Fields: Player Name, Opponent Name, Timestamp, and Proof Status.

  1. Technical Requirements:

- Use a Task/Runnable to handle the Action Bar countdown every second. - Ensure the Discord Webhook is sent Asynchronously to prevent server lag. - Use a HashMap to store the player's combat expiration time. - Provide the Java code and the plugin.yml content.

Kodari AI
KodariJul 6 at 1:22 pm 1

I’ll create a Combat Log plugin with action bar countdown, chat notifications, and Discord webhook logging.

CombatLog
A combat logging prevention plugin for Spigot/Paper. Tracks player-vs-player combat with a 15-second timer displayed as a live countdown on the action bar. Sends red warning messages during combat and green all-clear messages when combat ends. Automatically logs combat loggers to a Discord webhook with embed details including player name, opponent, timestamp, and confirmation proof. Runs asynchronously to prevent server lag.
Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
7 286
src/main/java/com/combatlog/CombatLogPlugin.java
package com.combatlog;

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

public class CombatLogPlugin extends JavaPlugin {

    private CombatManager combatManager;

    @Override
    public void onEnable() {
        combatManager = new CombatManager();

        CombatListener listener = new CombatListener(this, combatManager);
        Bukkit.getPluginManager().registerEvents(listener, this);

        CombatTask task = new CombatTask(combatManager);
        task.runTaskTimer(this, 0L, 20L);

        getLogger().info("CombatLog enabled!");
    }

    @Override
    public void onDisable() {
        getLogger().info("CombatLog disabled.");
    }

    public CombatManager getCombatManager() {
        return combatManager;
    }
}