rohan_plays07
📎 1 file 5,156 chars
📄
pasted-code-1794252435762.txt
txt 158 lines
▶
# ⚔️ SpaceCraft Combat – Premium Custom Minecraft Plugin

Develop a premium-quality, fully configurable Minecraft PvP Combat Tag plugin for my server **SpaceCraft**.

## 1. Combat Tag System
- Automatically tag players when they attack or receive damage from another player.
- Default combat duration: 15 seconds.
- Reset the timer whenever the player deals or receives PvP damage.
- Display a live combat countdown in the ActionBar.
- Add an optional customizable BossBar.
- Automatically remove the combat tag when the timer expires.
- Prevent players from escaping combat through prohibited methods.

## 2. Command Restrictions
While a player is in combat, block all commands that can be used to escape, avoid PvP, or gain an unfair advantage.

Default blocked commands:

- `/spawn`
- `/home`, `/sethome`
- `/tpa`, `/tpaccept`, `/tpahere`
- `/warp`, `/back`
- `/rtp`, `/wild`
- `/hub`, `/lobby`
- `/fly`, `/gamemode`
- `/god`, `/vanish`
- `/heal`, `/feed`
- `/ec`, `/enderchest`
- `/pv`, `/playervault`
- `/shop`, `/trade`

Requirements:
- Support command aliases and subcommands.
- Support commands registered by third-party plugins.
- Allow administrators to configure blocked and permitted commands.
- Prevent command-based teleportation and escape exploits.
- Use proper command matching to avoid accidentally blocking unrelated commands.

## 3. Combat Escape Prevention
During combat:
- Block teleportation through supported plugins.
- Block Chorus Fruit teleportation.
- Disable Elytra flight and firework boosting.
- Prevent entering or leaving restricted PvP zones to escape combat.
- Prevent opening configured escape-related GUIs.
- Prevent switching to another server through supported proxy integrations.

**IMPORTANT ENDER PEARL RULE:**
- Ender Pearls MUST remain usable during combat.
- Ender Pearl throwing must not be cancelled.
- Ender Pearl teleportation must work normally.
- Never add Ender Pearls to the blocked item or teleport list.

## 4. Combat Logging Protection
- Detect when a player disconnects during combat.
- Apply a configurable punishment.
- Default punishment: Kill the player.
- Preserve inventory and drops according to configuration.
- Broadcast a customizable combat logging message.
- Prevent relogging exploits.
- Handle server shutdowns and unexpected disconnects safely.

## 5. Combat Messages

Provide fully customizable messages with color-code and PlaceholderAPI support.

**Combat Started**
`&c⚔ &fYou are now in combat! &7Do not log out or escape.`

**Combat ActionBar**
`&c⚔ Combat: &f%time%s`

**Combat Ended**
`&a✔ &fYou are no longer in combat!`

**Blocked Command**
`&c✘ &fYou cannot use this command during combat!`

**Combat Logging**
`&c⚔ &fYou logged out during combat and were punished!`

## 6. Admin Commands

Implement the following commands:

- `/combat reload`
- `/combat status `
- `/combat tag `
- `/combat untag `
- `/combat end `
- `/combat bypass `
- `/combat version`

Include proper permission nodes and tab completion.

## 7. Configuration System

Create a detailed and organized `config.yml` with:

- Combat duration.
- Combat timer settings.
- Blocked commands.
- Allowed commands.
- Command aliases.
- Combat messages.
- ActionBar and BossBar settings.
- Combat logging punishment.
- Disabled combat mechanics.
- World exclusions.
- Region exclusions.
- Permission-based bypass.
- Third-party plugin integrations.
- Ender Pearl protection setting (always enabled).

All settings must be configurable without modifying source code.

## 8. Compatibility and Performance

- Minecraft version: 1.21.11.
- Server software: Paper and Purpur.
- Programming language: Java.
- Build system: Maven.
- Support PlaceholderAPI.
- Support LuckPerms.
- Support common teleportation, homes, economy, shop and GUI plugins.
- Support optional BungeeCord/Velocity proxy integration.
- Optimize for 100+ concurrent players.
- Use efficient timer management.
- Prevent memory leaks and unnecessary repeating tasks.
- Ensure thread-safe handling of asynchronous events.

## 9. Developer Deliverables

Provide:
- Complete working Java source code.
- Compiled plugin `.jar`.
- `plugin.yml`.
- Fully documented `config.yml`.
- Maven `pom.xml`.
- Permissions documentation.
- Installation guide.
- Compatibility documentation.
- Testing instructions.

Do not provide incomplete code, pseudocode, TODOs, or placeholder implementations.

## 10. Final Quality Requirements

The plugin must:
- Be stable and production-ready.
- Prevent combat escape through commands and supported plugin integrations.
- Correctly detect combat logging.
- Have fully configurable messages and restrictions.
- Work reliably on Minecraft 1.21.11.
- Allow Ender Pearls normally during combat.
- Have clean, modular, optimized code.

**FINAL GOAL:** Create a premium-grade custom combat plugin named **SpaceCraft Combat**, ensuring players cannot escape PvP fights using teleport commands, logout exploits, or other prohibited methods
Kodari AI
KodariNov 9 at 7:29 pm 9
SpaceCraftCombat
A premium PvP combat tag plugin for Minecraft 1.21.11 Paper/Purpur servers. Automatically tags players during PvP with configurable 15-second duration, live ActionBar countdown, and optional BossBar. Blocks escape commands including teleportation, homes, warps, and admin commands while allowing Ender Pearls. Prevents combat logging with configurable kill punishment, blocks Chorus Fruit teleportation, Elytra flight, and GUI escapes. Features full command restrictions with alias support, admin commands for tag management, PlaceholderAPI integration, LuckPerms support, and comprehensive config.yml for all settings. Optimized for 100+ concurrent players with efficient timer management.
  • Build combat tagging, escape restrictions, and logout punishment.

  • Add configurable commands, messages, integrations, and administrator controls.

  • Document installation, permissions, compatibility, and testing.

Created SpaceCraft Combat with combat tagging, configurable restrictions, logout punishment, admin commands, and optional PlaceholderAPI and WorldGuard support.

The README documents installation, permissions, testing, and limitations. Proxy transfers require separate proxy-side enforcement; this plugin cannot reliably intercept every transfer.

To get the jar, click Compile in Kodari, then Download when the build succeeds.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
README.md
Code
9 587
src/main/java/com/spacecraft/combat/SpaceCraftCombat.java
package com.spacecraft.combat;

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

public final class SpaceCraftCombat extends JavaPlugin {
    private CombatManager combat;
    private boolean shuttingDown;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        combat = new CombatManager(this);
        CombatCommand command = new CombatCommand(this, combat);
        getCommand("combat").setExecutor(command);
        getCommand("combat").setTabCompleter(command);
        Bukkit.getPluginManager().registerEvents(new CombatListener(this, combat), this);
        combat.startTask();
    }

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

    public boolean isShuttingDown() { return shuttingDown; }
}