raymc_1

🎮 Anti-Gang System Fair PvP is now enforced! When 3+ players gang up on one person, their damage is automatically reduced. Fight fair or get nerfed. • 1v1 & 2v2 fights = 100% damage ✅ • 3+ attackers = damage reduced 70-25% ⚠️ • Dynamic & real-time adjustment Make me a prompt for this minecraft plugin

Here’s a clean, detailed prompt you can use (for AI generation, dev documentation, or plugin design):

Prompt:

Create a Minecraft PvP plugin called “Anti-Gang System (Fair PvP)” that dynamically balances combat when multiple players attack a single target.

Core Features:

Detect when multiple players attack the same player within a short time window (e.g., 3–5 seconds).

If 1v1 or 2v2 combat, all players deal 100% normal damage.

If 3 or more attackers target one player, apply a damage reduction system to attackers:

3 attackers → ~70% damage

4 attackers → ~50% damage

5+ attackers → ~25% damage

Damage scaling should be dynamic and update in real time as attackers join or leave combat.

Combat Tracking:

Track attackers per victim using a combat tagging system.

Reset tracking if no damage is dealt within a configurable timeout.

Ensure accuracy even in chaotic fights.

Additional Mechanics:

Only reduce damage for attackers, not the victim.

Prevent exploits such as:

Players briefly hitting and leaving to manipulate scaling

Friendly fire abuse (optional toggle)

Support both melee and projectile damage.

Feedback System:

Notify players when damage is reduced:

Action bar / title message: “⚠️ Anti-Gang: Damage Reduced!”

Optional debug mode showing:

Number of attackers

Current damage multiplier

Configuration:

Fully configurable via config.yml:

Damage scaling percentages

Time window for attacker detection

Minimum attackers to trigger system

Enable/disable messages

Permission support:

Bypass permission (e.g., antigang.bypass)

Performance:

Optimized for large PvP servers.

Use efficient data structures (e.g., HashMaps with timestamps).

Avoid heavy loops or lag spikes.

Compatibility:

Works with Spigot/Paper API (1.20+)

Compatible with other combat plugins if possible.

Goal:

Ensure fair PvP by discouraging ganging while maintaining a smooth and competitive combat experience.

If you want, I can turn this into actual Java plugin code or a ready-to-compile Spigot project.

Working with purpur

Got it—here’s a refined prompt specifically tailored for a Purpur-based Minecraft server (since Purpur has extra config hooks and performance tweaks you can leverage):

🎮 Purpur-Optimized Prompt: Anti-Gang System (Fair PvP) Prompt:

Create a high-performance Minecraft PvP plugin for Purpur (Paper-compatible) called “Anti-Gang System (Fair PvP)” that dynamically reduces damage when multiple players attack a single target.

⚙️ Core Mechanics Detect when multiple unique players damage the same target within a configurable time window (default: 4 seconds).

Classify combat scenarios:

1v1 or 2v2 → 100% damage

3+ attackers → apply scaling reduction:

3 attackers → 70% damage

4 attackers → 50% damage

5+ attackers → 25% damage

Scaling must be real-time and recalculated every hit.

🧠 Combat Tracking System Use UUID-based tracking of attackers per victim.

Store:

Last hit timestamp

Active attackers set

Remove attackers after timeout expires.

Handle:

Melee hits

Projectiles (track shooter properly)

Indirect damage sources (optional toggle)

⚡ Purpur Optimization Use async-safe logic where possible, but ensure all entity interaction stays on main thread.

Minimize object creation inside events like EntityDamageByEntityEvent.

Use fast collections (e.g., primitive maps or optimized HashMaps).

Take advantage of Purpur/Paper:

Event priorities for compatibility

Optional integration with Purpur config (if needed)

🛡️ Exploit Prevention Prevent:

Hit-and-run scaling abuse (require minimum participation time or hit count)

Fake attackers (alt accounts detection optional)

Optional:

Ignore teammates (scoreboard/team support)

Ignore party members (hook into popular party plugins)

📢 Player Feedback Action bar (preferred for Purpur servers):

⚠ Anti-Gang: Damage Reduced (X attackers)

Optional:

Sound effect when nerf applies

Boss bar (toggleable)

📁 Configuration (config.yml) combat: timeout-seconds: 4 min-attackers: 3

scaling: 3: 0.7 4: 0.5 5: 0.25

messages: enabled: true actionbar: true

permissions: bypass: antigang.bypass

hooks: ignore-teams: true ignore-parties: false 🔑 Permissions antigang.bypass → ignores all reductions

antigang.debug → shows attacker count + multiplier

🔄 Events & API Listen to:

EntityDamageByEntityEvent

Provide API:

getAttackerCount(Player victim)

getDamageMultiplier(Player victim)

🎯 Goal Deliver a lag-free, competitive PvP balancing system optimized for Purpur servers, ensuring fair fights without ruining team combat dynamics.

Kodari AI
KodariApr 5 at 2:57 am 11,120 (v2)
AntiGangPvP
A Purpur-optimized PvP balancing plugin that dynamically reduces damage when multiple players gang up on a single target. Features real-time attacker tracking, configurable damage scaling (3 attackers=70%, 4=50%, 5+=25%), exploit prevention, action bar feedback, bypass permissions, and an API for attacker count and multiplier queries. Uses UUID-based combat tracking with configurable timeouts and supports melee and projectile damage.
  • Build CombatTracker for UUID-based attacker tracking with timestamps, DamageScaler for multiplier logic, GangListener for event handling, ConfigManager for all config, and main plugin class with API methods

  • Need plugin.yml, config.yml, and all Java files from scratch

Here’s what was built:

  • CombatTracker — UUID-based attacker registry with timestamps, auto-cleanup task every second, thread-safe ConcurrentHashMap storage

  • DamageScaler — Reads scaling map from config, uses TreeMap.floorEntry() for dynamic fallback (5+ attackers use the highest defined key’s multiplier)

  • GangListener — Handles EntityDamageByEntityEvent at HIGH priority, resolves projectile shooters, checks team membership, applies multiplier via event.setDamage(), sends action bar feedback

  • ConfigManager — Parses all config.yml keys cleanly using section.getInt/Double/getBoolean

  • Bypass via antigang.bypass permission, debug output toggle via debug: false in config, team ignore via scoreboard API

raymc_1

The damage lowers when members gang up with the multiplier

Kodari AI
KodariApr 5 at 3:01 am 10,365 (v2)

Let me read the relevant files first.

The bug is in DamageScaler.getMultiplier(). When floorEntry returns null (attacker count is below all configured scaling keys but still ≥ minAttackers), the fallback incorrectly grabs firstEntry() — the most punishing tier — instead of returning 1.0. Also, the multiplier values (e.g. 0.70) are applied as damage * 0.70, meaning they represent the remaining damage fraction, so the debug/feedback message saying "Damage Reduced to 70%" is misleading — it should say "reduced by 30%".

  • Fix the firstEntry fallback to return 1.0

  • Fix the feedback/debug percentage to show the actual reduction amount, not the remaining amount

Two fixes applied:

  1. DamageScaler — the firstEntry() fallback (wrong, applies the most-punishing tier when no floor key exists) is replaced with return 1.0, so edge-case configs don’t over-penalize

  2. GangListener — feedback and debug messages now correctly report the reduction amount ((1 - multiplier) * 100) rather than the remaining damage fraction, so 3: 0.70 correctly displays "Reduced by 30%" instead of the misleading "Reduced to 70%"

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
8 348
src/main/java/com/antigang/AntiGang.java
package com.antigang;

import com.antigang.combat.CombatTracker;
import com.antigang.combat.DamageScaler;
import com.antigang.config.ConfigManager;
import com.antigang.listener.GangListener;
import lombok.Getter;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public class AntiGang extends JavaPlugin {

    @Getter private static AntiGang instance;
    @Getter private ConfigManager configManager;
    @Getter private CombatTracker combatTracker;
    @Getter private DamageScaler damageScaler;

    @Override
    public void onEnable() {
        instance = this;
        saveDefaultConfig();
        this.configManager = new ConfigManager(this);
        this.combatTracker = new CombatTracker(this);
        this.damageScaler = new DamageScaler(this);
        getServer().getPluginManager().registerEvents(new GangListener(this), this);
        getLogger().info("AntiGang PvP system enabled.");
    }

    @Override
    public void onDisable() {
        if (this.combatTracker != null) {
            this.combatTracker.shutdown();
        }
        getLogger().info("AntiGang PvP system disabled.");
    }

    public int getAttackerCount(Player victim) {
        return combatTracker.getActiveAttackers(victim.getUniqueId()).size();
    }

    public double getDamageMultiplier(Player victim) {
        int count = getAttackerCount(victim);
        return damageScaler.getMultiplier(count);
    }
}