Gtxy Gaming
📎 1 file 14,624 chars
📄
pasted-code-1789284955000.txt
txt 778 lines
▶
Create a production-ready Minecraft Java server plugin called **FakePlayerPvP** for **Paper 1.21.11**.

The main purpose of this plugin is to spawn configurable fake player NPCs that behave like real Minecraft PvP players during an End Fight / PvP event.

## 1. Main Command

Add the command:

`/start fakeplayer `

Example:

`/start fakeplayer 10`

When the command is executed:

1. Validate the amount.
2. Ask the command sender which equipment tier the fake players should use.
3. Provide two choices:

   * Diamond
   * Netherite
4. After the tier is selected, ask:

   * Which player should the fake players fight?
5. The sender enters/selects a player name.
6. Spawn the requested number of fake players near the target.
7. All fake players immediately enter combat mode and attempt to fight the selected target.

Do NOT make the fake players passive mobs. They must behave as actual PvP combatants.

---

# 2. Kit Selection

Create two complete PvP kits.

### Diamond Kit

Each fake player receives:

* Full Diamond Helmet
* Full Diamond Chestplate
* Full Diamond Leggings
* Full Diamond Boots
* Diamond Sword
* Bow
* Arrows
* 5–6 Golden Apples
* Food
* Optional utility items appropriate for End PvP

The armor and sword should have configurable enchantments.

### Netherite Kit

Each fake player receives:

* Netherite Helmet
* Netherite Chestplate
* Netherite Leggings
* Netherite Boots
* Netherite Sword
* Bow
* Arrows
* 5–6 Golden Apples
* Food
* Optional utility items appropriate for End PvP

Use proper PvP-oriented enchantments.

All kit contents must be configurable in `config.yml`.

Example:

`kits.netherite.armor.enchantments`

`kits.netherite.sword.enchantments`

`kits.netherite.golden_apples`

Do NOT hard-code the equipment permanently.

---

# 3. Fake Player Appearance

Fake players must visually appear as Minecraft players, NOT zombies, mobs, armor stands, or invisible entities.

They should have:

* Player model
* Player skin
* Player name above their head
* Equipment visible
* Normal player movement
* Normal player animations
* Swing animation when attacking
* Damage animation
* Knockback
* Eating animation
* Bow animation when using a bow

Allow configurable fake-player names such as:

`Warrior_01`
`Warrior_02`
`Warrior_03`

etc.

Avoid names that make it obvious they are NPCs unless configured by the server owner.

---

# 4. Target System

After `/start fakeplayer ` and kit selection, ask:

`Which player should the fake players fight?`

The target must be a real online player.

Example:

`/start fakeplayer 10`

Plugin:

`Select Kit: Diamond / Netherite`

Admin selects:

`Netherite`

Plugin:

`Enter the player to attack:`

Admin enters:

`Gtxy`

The plugin then assigns `Gtxy` as the target for all spawned fake players.

---

# 5. Spawn Behaviour

Spawn the fake players around the target at configurable distances.

Example configuration:

`spawn-radius: 8`

The plugin should choose different positions around the target instead of spawning every fake player at exactly the same location.

Avoid:

* Spawning inside blocks
* Spawning inside the target
* Spawning in the void
* Spawning in dangerous locations unless intentionally configured

Before spawning, check whether the location is safe.

After spawning, fake players should face toward the target and begin searching for a path toward them.

---

# 6. REALISTIC PvP BEHAVIOUR

This is the MOST IMPORTANT part.

The fake players should NOT behave like zombies or simple Minecraft mobs.

They should simulate a human Minecraft PvP player.

Their combat AI must include:

### Target Tracking

* Continuously track the assigned target.
* Look toward the target naturally.
* Move toward the target.
* Maintain an appropriate combat distance.
* Recalculate target position frequently.
* Handle target movement.

### Melee Combat

When within sword range:

* Attack using the sword.
* Do not spam attacks every tick.
* Respect Minecraft attack cooldown.
* Randomize attack timing slightly.
* Move while attacking.
* Occasionally strafe.
* Occasionally change direction.
* Avoid standing completely still.

The attack timing should have small randomness so every fake player does not attack identically.

---

# 7. HUMAN-LIKE MOVEMENT

Implement several movement behaviours.

The fake player should sometimes:

* Walk directly toward the target
* Strafe left
* Strafe right
* Back away
* Reposition
* Circle around the target
* Briefly stop
* Resume attacking
* Change movement direction
* Attempt to avoid incoming attacks

Do NOT make every fake player use exactly the same movement pattern.

Each fake player should have slightly different behaviour parameters.

Example:

Fake Player 1:

* Aggression: high
* Strafing: frequent
* Retreat chance: low

Fake Player 2:

* Aggression: medium
* Strafing: medium
* Retreat chance: medium

Fake Player 3:

* Aggression: high
* Strafing: low
* Retreat chance: high

This should make the group look like multiple different players instead of clones.

---

# 8. DAMAGE REACTION

When a fake player receives damage:

The AI should react.

Possible behaviours:

* Briefly retreat
* Strafe away
* Turn toward attacker
* Continue attacking
* Reposition
* Increase aggression
* Attempt to heal if health becomes low

Do NOT make them completely ignore incoming damage.

For example:

Target hits FakePlayer_01 several times.

FakePlayer_01 should potentially:

1. Move backward.
2. Strafe.
3. Look at the target.
4. Decide whether to continue attacking.
5. Eat a Golden Apple if health is low.

---

# 9. GOLDEN APPLE SYSTEM

Fake players must intelligently use Golden Apples.

Do not make them eat apples randomly.

Example logic:

If health <= configurable threshold:

`eat Golden Apple`

Default:

`health <= 45%`

Before eating:

* Move away from immediate melee range when possible.
* Face the target or maintain awareness.
* Perform a realistic eating duration.
* Do not attack during the eating action unless configured.
* Resume combat after eating.

The AI should not waste all Golden Apples immediately.

Allow configuration:

`golden-apple-health-threshold: 45`

`golden-apple-min-delay: 3`

`golden-apple-max-delay: 8`

---

# 10. LOW-HEALTH BEHAVIOUR

When a fake player reaches low health:

They should have a chance to:

* Retreat
* Strafe aggressively
* Eat a Golden Apple
* Reposition
* Return to combat after healing

Example:

At 30% health:

`retreat`

At 45% health:

`consider golden apple`

At 70%+ health:

`normal combat`

All thresholds configurable.

---

# 11. KNOCKBACK RESPONSE

Fake players must react naturally to Minecraft knockback.

When hit:

* Receive normal knockback.
* Recover from knockback.
* Reorient toward target.
* Continue combat.
* Do not instantly teleport back.

Absolutely NO teleporting directly onto the target during normal combat.

---

# 12. PATHFINDING

The fake players need proper pathfinding.

They should navigate around:

* Blocks
* Small obstacles
* Terrain
* Structures

They should not constantly walk directly into walls.

Use an appropriate Paper-compatible pathfinding implementation or create a lightweight navigation system.

The plugin must remain performant with multiple fake players.

---

# 13. END DIMENSION SUPPORT

The plugin must work properly in The End.

Fake players should be able to:

* Navigate End terrain
* Fight around End islands
* Handle uneven terrain
* Avoid walking directly into the void where possible

Add basic void-awareness.

If a fake player detects that its next movement would likely cause it to fall into the void:

* Stop
* Recalculate path
* Move away from the edge

Do NOT allow suicidal movement into the void unless the AI is intentionally forced there by combat.

---

# 14. COMBAT TARGET PRIORITY

Initially, all fake players target the selected player.

If the target dies:

Stop combat and either:

1. Make fake players idle, OR
2. Despawn them automatically.

Make this configurable.

Example:

`despawn-after-target-death: true`

If the target disconnects:

* Stop attacking.
* Wait for configurable timeout.
* Either despawn or return to idle.

---

# 15. DEATH SYSTEM

Fake players must have proper health.

When their health reaches zero:

* Play normal death behaviour.
* Drop items optionally.
* Remove the fake player after death.
* Prevent permanent dead NPC entities from remaining.

Config:

`drop-items-on-death: false`

`remove-after-death: true`

---

# 16. FAKE PLAYER MANAGEMENT

Add:

`/fakeplayers`

Shows currently active fake players.

Add:

`/fakeplayers stop`

Stops all fake players.

Add:

`/fakeplayers stop `

Stops one fake player.

Add:

`/fakeplayers list`

Shows active fake players.

Add:

`/fakeplayers reload`

Reloads configuration.

Also support:

`/start fakeplayer stop`

as an alternative emergency stop command.

---

# 17. CONFIGURATION

Create a clean `config.yml`.

Example structure:

```yaml
fake-player:
  default-health: 20.0
  spawn-radius: 8
  attack-range: 3.2
  movement-speed: 0.30

combat:
  attack-cooldown: true
  random-attack-delay: true
  strafing: true
  retreating: true
  dodge-behaviour: true

healing:
  golden-apple-health-threshold: 45
  retreat-before-eating: true

behaviour:
  aggression-randomization: true
  personality-randomization: true
  reaction-randomization: true

target:
  disconnect-timeout: 10
  stop-on-death: true

death:
  remove-after-death: true
  drop-items-on-death: false

kits:
  diamond:
    golden_apples: 6

  netherite:
    golden_apples: 6
```

---

# 18. PERFORMANCE

The plugin must be optimized.

Do NOT run expensive AI calculations every tick for every fake player.

Use different update frequencies.

Example:

* Movement decision: every few ticks
* Target check: frequent but lightweight
* Pathfinding: only when necessary
* Combat decision: based on attack cooldown
* Healing decision: event-driven where possible

The plugin must be capable of handling approximately:

10–20 fake players simultaneously on a normal server.

Avoid memory leaks.

Clean up all tasks, entities, listeners and references when fake players are removed.

---

# 19. ADMIN PERMISSION

Add permission:

`fakeplayer.admin`

Only players with this permission can execute:

`/start fakeplayer`

`/fakeplayers`

Commands.

Add helpful permission error messages.

---

# 20. COMMAND FLOW

The final user experience should be:

Player types:

`/start fakeplayer 10`

Plugin asks:

`Choose equipment tier:`

Buttons:

`[Diamond] [Netherite]`

Admin selects:

`Netherite`

Plugin asks:

`Who should they fight?`

Admin enters/selects:

`Gtxy`

Plugin confirms:

`10 Netherite fake players will fight Gtxy.`

Then:

`Spawning combatants...`

The fake players spawn around Gtxy and immediately begin approaching and fighting.

---

# 21. IMPORTANT REALISM REQUIREMENT

The goal is NOT to create ordinary mob AI.

The fake players should visually and behaviourally resemble human Minecraft PvP players as much as technically possible.

They should:

* Move unpredictably
* Strafe
* Attack with realistic timing
* React to damage
* Retreat sometimes
* Heal intelligently
* Re-engage
* Track the target
* Navigate terrain
* Have slightly different personalities
* Avoid perfectly synchronized behaviour

Do NOT create a simple:

`move toward player -> attack -> repeat`

AI.

Create a proper state-based combat system.

Suggested states:

```text
IDLE
SEARCHING
APPROACHING
MELEE_COMBAT
STRAFING
RETREATING
HEALING
REPOSITIONING
RECOVERING
DEAD
```

The AI should transition between these states based on health, distance, incoming damage, target position, cooldowns and randomized personality parameters.

---

# 22. ANTI-CLONE BEHAVIOUR

Each fake player must receive a randomly generated personality profile when spawned.

Example attributes:

```text
Aggression
Strafe frequency
Retreat probability
Attack timing variance
Preferred combat distance
Healing threshold
Movement randomness
Reaction speed
```

Keep these differences subtle.

The goal is for 10 fake players to look like 10 different human players, not 10 identical bots.

---

# 23. SAFETY / SERVER CONTROL

Add an emergency global stop.

`/fakeplayers stop`

This must immediately:

* Stop AI tasks
* Remove fake players
* Cancel combat behaviour
* Clear target assignments
* Clean all plugin references

The plugin must also clean up all fake players when the server shuts down or the plugin is disabled.

---

# 24. CODE QUALITY

Use clean Java architecture.

Recommended structure:

```text
FakePlayerPvP
├── commands
│   ├── StartFakePlayerCommand
│   └── FakePlayersCommand
│
├── npc
│   ├── FakePlayer
│   ├── FakePlayerManager
│   └── FakePlayerProfile
│
├── ai
│   ├── CombatAI
│   ├── MovementAI
│   ├── TargetManager
│   ├── PathfindingManager
│   └── BehaviourState
│
├── combat
│   ├── AttackController
│   ├── HealingController
│   └── DamageReaction
│
├── kits
│   └── KitManager
│
├── config
│   └── ConfigManager
│
└── listeners
    └── CombatListener
```

Use Paper API / compatible libraries where appropriate.

Do not use deprecated APIs unnecessarily.

---

# 25. DELIVERY REQUIREMENTS

Provide:

1. Complete source code.
2. `plugin.yml`.
3. `config.yml`.
4. Maven or Gradle build file.
5. Installation instructions.
6. Commands and permissions.
7. Explanation of how the fake-player system works.
8. Clear dependency list.
9. Instructions for compiling the `.jar`.
10. Make sure the project targets Paper 1.21.11.

Most importantly, do NOT give pseudo-code only.

Provide a complete compilable plugin implementation.

If a true client-side player NPC requires a specific packet/NMS approach or external library, clearly identify that dependency and implement it correctly rather than pretending a normal Bukkit entity is a real player.

The final result should be a working Minecraft server plugin, not just a concept.
Kodari AI
KodariSep 13 at 7:39 am 2
FakePlayerPvP
Spawning configurable fake player NPCs that simulate real Minecraft PvP combatants for End Fight events. Features interactive kit selection (Diamond/Netherite), state-based combat AI with human-like movement, strafing, retreating, healing, and damage reactions. Includes pathfinding, void awareness, personality randomization, and comprehensive management commands with configurable YAML settings.
  1. Create the Gradle/Paper/Citizens project metadata and default configuration.

  2. Implement configuration, kits, profiles, NPC lifecycle, and state-based combat management.

  3. Add command flow, click/chat selection, combat listeners, plugin registration, and shutdown cleanup.

  4. Add installation and usage documentation.

  1. Created the complete FakePlayerPvP Paper plugin project targeting Paper 1.21.11 and Java 21.

  2. Added Citizens-based player NPC spawning with configurable names, equipment, enchantments, kits, health, and spawn safety.

  3. Implemented state-based combat behavior including approaching, strafing, melee attacks, damage reactions, retreating, healing, target timeout, and void awareness.

  4. Added commands:

    • /start fakeplayer <amount>

    • /start fakeplayer stop

    • /fakeplayers list

    • /fakeplayers stop [name]

    • /fakeplayers reload

  5. Added Diamond and Netherite kits, plugin.yml, config.yml, Gradle build files, and installation documentation.

  6. Added Citizens as the required external server dependency and documented setup in README.md.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
README.md
settings.gradle
Code
14 856
src/main/java/com/kodari/fakeplayerpvp/FakePlayerPvPPlugin.java
package com.kodari.fakeplayerpvp;

import com.kodari.fakeplayerpvp.commands.FakePlayersCommand;
import com.kodari.fakeplayerpvp.commands.StartFakePlayerCommand;
import com.kodari.fakeplayerpvp.config.ConfigManager;
import com.kodari.fakeplayerpvp.kits.KitManager;
import com.kodari.fakeplayerpvp.npc.FakePlayerManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public final class FakePlayerPvPPlugin extends JavaPlugin {
    private ConfigManager configManager;
    private KitManager kitManager;
    private FakePlayerManager fakePlayerManager;

    @Override
    public void onEnable() {
        configManager = new ConfigManager(this);
        kitManager = new KitManager(this);
        fakePlayerManager = new FakePlayerManager(this, configManager, kitManager);

        StartFakePlayerCommand start = new StartFakePlayerCommand(this);
        getCommand("start").setExecutor(start);
        getCommand("start").setTabCompleter(start);
        getCommand("fakeplayers").setExecutor(new FakePlayersCommand(this));
        Bukkit.getPluginManager().registerEvents(start, this);
        Bukkit.getPluginManager().registerEvents(fakePlayerManager, this);
        fakePlayerManager.startTicker();
    }

    @Override
    public void onDisable() {
        if (fakePlayerManager != null) {
            fakePlayerManager.stopAll();
        }
    }

    public ConfigManager getConfigManager() { return configManager; }
    public KitManager getKitManager() { return kitManager; }
    public FakePlayerManager getFakePlayerManager() { return fakePlayerManager; }
}