2620_godly
📎 1 file 2,474 chars
📄
pasted-code-1787474814782.txt
txt 81 lines
▶
Create a Minecraft server plugin for **Paper/Spigot** called **CombatLog**.

### Main Feature

When a player enters combat with another player, they become **combat-tagged**.

### Combat System

* A player enters combat when they damage another player.
* Default combat duration: **30 seconds**.
* Every time the player deals or receives PvP damage, the combat timer resets to 30 seconds.
* Display the remaining combat time in the action bar.
* Example: `⚔ In Combat: 25s`
* When the timer reaches 0, the player is no longer in combat.

### Combat Logging

If a player **disconnects while combat-tagged**:

* Immediately kill the player.
* Make the death count as a normal Minecraft death.
* Drop their inventory at their death location.
* Broadcast a message such as:
  `⚔ PlayerName logged out during combat and was killed!`

### Restrictions

While combat-tagged:

* Prevent `/spawn`.
* Prevent `/home`.
* Prevent `/tpa`.
* Prevent teleportation commands.
* Prevent switching to another server if using a proxy.
* Optionally prevent entering certain protected regions.

### Commands

Add:

* `/combatlog reload` — reload the configuration.
* `/combatlog status ` — check whether a player is currently combat-tagged.
* `/combatlog forcetag ` — manually combat-tag a player.
* `/combatlog remove ` — manually remove combat tag.

Add permission nodes:

* `combatlog.admin`
* `combatlog.bypass`

Players with `combatlog.bypass` should not be combat-tagged or punished for combat logging.

### Configuration

Create a `config.yml` containing:

* Combat duration
* Action-bar message
* Combat-start message
* Combat-end message
* Combat-log death message
* Whether commands are blocked
* List of blocked commands
* Whether teleportation is blocked
* Whether combat logging drops items
* Whether combat logging broadcasts a message
* Bypass permission

Make all messages fully customizable with Minecraft color codes.

### Compatibility

* Target modern Minecraft versions.
* Use the Paper API where appropriate.
* Do not use unnecessary dependencies.
* Make the plugin lightweight and optimized.
* Make sure combat timers are properly cleaned up when combat ends or players leave.
* Prevent exploits such as relogging to avoid the combat timer.

Provide the complete source code, `plugin.yml`, `config.yml`, and clear instructions for compiling and installing the plugin.
Kodari AI
KodariAug 23 at 8:50 am 1
CombatLog
A lightweight Paper/Spigot plugin that tags players entering PvP combat for a configurable duration. Displays remaining combat time via action bar, resets timer on new damage, and punishes combat loggers by killing them and dropping their inventory. Blocks teleportation commands and region entry while tagged. Includes admin commands for reloading config, checking status, force-tagging, and removing tags. Fully configurable messages with color codes, permission nodes for admin and bypass, and optimized timer cleanup to prevent relogging exploits.
  1. Bootstrap a modern Paper plugin with Gradle metadata and configurable resources.

  2. Implement combat tagging, timer/action-bar updates, expiry cleanup, and combat-log deaths.

  3. Add command administration, command/teleport restrictions, permissions, and installation instructions in the source layout.

Implemented the complete CombatLog Paper plugin.

Included:

  • Combat tagging with configurable duration and timer resets

  • Action-bar countdown

  • Combat start/end messages

  • Combat logging punishment and inventory drops

  • Configurable blocked commands and teleportation restrictions

  • Bypass permission support

  • /combatlog reload

  • /combatlog status <player>

  • /combatlog forcetag <player>

  • /combatlog remove <player>

  • Admin and bypass permissions

  • plugin.yml

  • config.yml

  • Gradle build files

  • README with compilation and installation instructions

Build with:

Shell
./gradlew build

The resulting jar will be located at:

Plain Text
build/libs/CombatLog-1.0.0.jar
2620_godly

can you add a INVENTORY GUI where if i type /combatgui it shows various options like disabling combat log pearl combat log and etc

Kodari AI
KodariAug 23 at 9:12 am 2
  1. Add a /combatgui command and inventory menu with clickable per-player toggles.

  2. Apply the toggles to normal PvP combat tagging and ender-pearl combat tagging.

  3. Register GUI handling, add messages/configuration, and update plugin documentation.

Added /combatgui with a clickable inventory menu.

GUI options

  • Combat Logging — enables or disables PvP combat tagging and combat-log punishment for the player.

  • Pearl Combat — controls whether using an ender pearl starts a combat tag.

  • Combat Restrictions — enables or disables blocked commands and teleport restrictions while tagged.

  • Close button.

Added functionality

  • /combatgui command

  • Persistent per-player settings stored in:

    Plain Text
    plugins/CombatLog/player-settings.yml
    
  • Configurable GUI title, size, item materials, names, lore, slots, and defaults

  • Inventory clicks and dragging are blocked inside the GUI

  • Settings automatically save when changed

  • Ender-pearl teleport combat tagging

  • Existing combat-log, command restriction, and teleport systems now respect GUI settings

  • Updated plugin.yml, config.yml, and README.md

2620_godly

make it admin configurable.click to on and off.1.pearl adds combat timer.windcharge cooldown,trident ussage.mace cooldown.pearl cooldown.

Kodari AI
KodariAug 23 at 9:27 am 3
  1. Extend the existing GUI/settings model with admin-configurable click-to-toggle options for pearls, wind charges, tridents, maces, and pearl cooldown.

  2. Enforce those settings in combat/event handling and persist them per player.

  3. Update commands, configuration, and documentation for the new options.

[Generation stopped]

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
README.md
settings.gradle
Code
12 1,139
src/main/java/com/kodari/combatlog/CombatLogPlugin.java
package com.kodari.combatlog;

import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;

public final class CombatLogPlugin extends JavaPlugin {
    private CombatSettingsManager settingsManager;
    private CombatManager combatManager;
    private BukkitTask combatTask;

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

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

        CombatGui combatGui = new CombatGui(this, combatManager, settingsManager);
        Bukkit.getPluginManager().registerEvents(combatGui, this);

        PluginCommand combatGuiCommand = getCommand("combatgui");
        if (combatGuiCommand != null) {
            combatGuiCommand.setExecutor(new CombatGuiCommand(combatGui));
        }

        CombatCommand command = new CombatCommand(this, combatManager);
        PluginCommand combatLogCommand = getCommand("combatlog");
        if (combatLogCommand != null) {
            combatLogCommand.setExecutor(command);
            combatLogCommand.setTabCompleter(command);
        }

        combatTask = Bukkit.getScheduler().runTaskTimer(this, combatManager::tick, 20L, 20L);
    }

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

    public CombatManager getCombatManager() {
        return combatManager;
    }
}