pixel_856
๐Ÿ“Ž 1 file 19,158 chars
๐Ÿ“„
pasted-code-1786817534479.txt
txt 1100 lines
โ–ถ
# NaitikRec โ€” Complete Final Minecraft Fake Player Plugin Specification

Create a **fully functional, production-ready Minecraft Java Paper/Spigot plugin** named **`NaitikRec`**.

The plugin is designed to create realistic **server-side fake player NPCs** that behave similarly to real Minecraft players.

The fake players must be able to:

**Spawn โ†’ Stay spawned โ†’ Walk โ†’ Follow โ†’ Fight โ†’ Perform natural critical hits โ†’ Wear custom armor โ†’ Hold custom items โ†’ Use effects โ†’ Change visible name โ†’ Manage inventory โ†’ Drop items โ†’ Stop โ†’ Remove**

Do not create placeholder commands. Every command must perform the actual in-game action.

---

# 1. Fake Player Core System

Create a reliable fake-player/NPC manager.

Every fake player must have:

* Unique internal UUID.
* Unique entity ID.
* Configurable visible name.
* Proper player-like hitbox.
* Health.
* Equipment.
* Inventory.
* Main-hand item.
* Offhand item.
* Potion effects.
* Movement controller.
* Combat controller.
* AI state.
* Current target.
* Current location.
* Individual movement speed.
* Individual attack cooldown.

Each fake player must be managed independently.

One fake player's AI must never interfere with another fake player's AI.

---

# 2. SPAWN SYSTEM

Command:

`/np spawn `

Example:

`/np spawn 5`

Spawn the requested number of fake players at the command sender's current location.

Automatically generate names:

```text id="i3v7gc"
Bot1
Bot2
Bot3
Bot4
Bot5
```

If a name already exists, generate another unique name.

## CRITICAL REQUIREMENT

Fake players must **NOT disappear after spawning**.

After:

`/np spawn 1`

Bot1 must remain spawned indefinitely until manually removed.

The bot must not disappear because:

* It is not a real Minecraft account.
* A temporary task ended.
* An entity reference was lost.
* The plugin garbage-collected an object.
* A fake connection was closed incorrectly.
* The bot has no real client connection.

If using NMS, packets, ProtocolLib, or another NPC implementation, correctly maintain the fake player's lifecycle, tracking, UUID, entity state, and required server-side representation.

---

# 3. REMOVE SYSTEM

Commands:

`/np remove `

Remove one fake player.

`/np remove all`

Remove every fake player.

When removing a fake player:

* Remove the entity.
* Stop all AI tasks.
* Stop combat tasks.
* Stop movement tasks.
* Clear target references.
* Clean UUID/entity mappings.
* Prevent memory leaks.
* Prevent orphaned scheduled tasks.

---

# 4. LIST SYSTEM

Command:

`/np list`

Show all active fake players.

Example:

```text id="6j4w8c"
Bot1 โ€” IDLE
Bot2 โ€” WALKING
Bot3 โ€” FOLLOWING
Bot4 โ€” FIGHTING
```

---

# 5. POSITION SYSTEM

Command:

`/np give    `

Example:

`/np give Bot1 100 65 -200`

Teleport the fake player to the specified location.

This command is explicitly allowed to teleport the bot.

After teleporting, the bot must remain fully functional.

---

# 6. WALK SYSTEM

Add:

`/np walk `

Example:

`/np walk Bot1`

The fake player must **physically walk around**.

Do not simulate movement only through animations.

Do not constantly teleport the fake player.

The bot should:

* Choose random nearby destinations.
* Walk toward them.
* Turn naturally.
* Stop briefly after reaching a destination.
* Choose another destination.
* Continue walking.
* Avoid walls.
* Avoid getting stuck.
* Jump over simple obstacles.
* Avoid dangerous locations.
* Maintain natural movement.

---

# 7. WALK RADIUS

Command:

`/np walk  `

Example:

`/np walk Bot1 20`

The bot should randomly walk within approximately the specified radius around its current walking area.

Default configuration:

```yaml id="g3fj1c"
walk:
  enabled: true
  radius: 15
  min-walk-time: 3
  max-walk-time: 8
  pause-min: 1
  pause-max: 3
```

Choose safe destinations only.

Avoid:

* Lava.
* Void.
* Solid blocks.
* Impossible locations.
* Dangerous drops where possible.

---

# 8. WALK SPEED COMMAND

Add:

`/np walk speed  `

Examples:

`/np walk speed Bot1 0.35`

`/np walk speed Bot1 0.50`

This changes the selected fake player's movement speed.

The new speed must apply immediately.

Configuration:

```yaml id="z5q2r0"
movement:
  default-walk-speed: 0.30
  max-walk-speed: 1.00
  default-follow-speed: 0.32
  default-combat-speed: 0.34
```

Requirements:

* Speed must be stored individually for each fake player.
* Speed must remain after changing AI states.
* Validate negative/invalid values.
* Prevent unreasonable speed values.
* Do not reset the speed when switching between walk/follow/fight.

---

# 9. FOLLOW SYSTEM

Command:

`/np follow  `

Example:

`/np follow Bot1 Naitik`

Bot1 must **physically follow Naitik**.

The bot must:

* Detect the player's location.
* Update the target location continuously.
* Move toward the player.
* Rotate toward the player.
* Maintain follow distance.
* Follow when the player moves.
* Follow when the player changes direction.
* Jump over simple obstacles.
* Avoid getting stuck.
* Avoid jitter.
* Avoid constant teleportation.

Do not simply rotate the bot toward the target.

Do not simply send a command-success message.

The bot must actually walk/run.

---

# 10. FOLLOW AI

Use a repeating AI controller.

It should:

1. Check the bot exists.
2. Check the target is online.
3. Get the latest target location.
4. Update path/direction.
5. Move toward target.
6. Rotate toward target.
7. Detect if stuck.
8. Recalculate when necessary.
9. Continue until stopped.

Do not run expensive pathfinding every tick.

---

# 11. FIGHT SYSTEM

Command:

`/np fight  `

Example:

`/np fight Bot1 Naitik`

The fake player must **actually chase and attack the target**.

Expected behavior:

```text id="s9d1fr"
Detect target
โ†“
Chase target
โ†“
Face target
โ†“
Reach attack range
โ†“
Wait for cooldown
โ†“
Attack
โ†“
Deal damage
โ†“
Continue chasing
โ†“
Attack again after cooldown
```

The bot must not simply stand still or look at the player.

---

# 12. COMBAT MOVEMENT

While fighting:

* Move toward target.
* Face target.
* Chase target if they run away.
* Update target location.
* Maintain attack range.
* Jump over simple obstacles.
* Avoid getting stuck.
* Recalculate path when needed.
* Do not constantly teleport.

---

# 13. REALISTIC COMBAT

**Do NOT spam attacks.**

The bot must use a proper attack cooldown.

Configuration:

```yaml id="p4d3k2"
combat:
  attack-range: 3.0
  attack-damage: 5.0
  attack-cooldown: 0.7
  realistic-attacks: true
```

The bot should attack at realistic intervals rather than attacking every tick.

---

# 14. CRITICAL HIT SYSTEM

The fake player must be capable of performing **natural Minecraft critical hits**.

Configuration:

```yaml id="v8tq7e"
combat:
  critical-hits: true
  critical-hit-chance: 0.35
```

Requirements:

* Do not make every hit a critical.
* Do not simply multiply damage randomly and call it a critical.
* The bot should use actual Minecraft critical-hit conditions.
* The bot can jump and attack while falling when appropriate.
* Maintain normal attack cooldown.
* Critical hits should feel natural.

If:

```yaml id="y1c9ab"
critical-hits: false
```

disable intentional critical-hit behavior.

---

# 15. COMBAT ROTATION

During combat:

* Head faces target.
* Body follows movement direction.
* Face target before attacking.
* Avoid random spinning.
* Avoid extremely unnatural rotation.
* Keep rotation synchronized with movement.

---

# 16. CUSTOM ARMOR SYSTEM

Command:

`/np armor `

Example:

`/np armor Bot1`

Copy the command sender's currently equipped armor to the fake player.

Copy:

* Helmet
* Chestplate
* Leggings
* Boots

The fake player must visually wear the exact same armor.

---

# 17. CUSTOM ARMOR DATA

Do not limit armor to Diamond/Netherite.

Copy the actual `ItemStack`.

Preserve supported:

* Enchantments.
* Custom name.
* Lore.
* Attributes.
* CustomModelData.
* Armor trims.
* Durability.
* Item flags.
* PersistentDataContainer.
* NBT/data components supported by the server version.
* Other item metadata.

This must work with custom server armor.

---

# 18. INDIVIDUAL ARMOR

Support:

`/np armor  helmet`

`/np armor  chestplate`

`/np armor  leggings`

`/np armor  boots`

Only copy the requested armor slot.

---

# 19. CUSTOM HAND ITEM

Command:

`/np hand `

Copy the command sender's current main-hand ItemStack.

Preserve all supported custom data.

The fake player must hold the exact custom item.

Example:

Player holds custom sword.

`/np hand Bot1`

Bot1 holds the same custom sword.

---

# 20. CLEAR EQUIPMENT

Commands:

`/np cleararmor `

Remove all armor.

`/np clearhand `

Remove main-hand item.

---

# 21. INVENTORY SYSTEM

Fake players must have a proper inventory.

Add:

`/np inventory `

Where technically supported, open/view the fake player's inventory.

The inventory should support:

* Main hand.
* Offhand.
* Armor.
* Inventory slots.
* Custom items.

---

# 22. INVENTORY DROP SYSTEM

When a fake player dies, handle inventory properly.

Configuration:

```yaml id="4r7n2a"
inventory:
  drop-items-on-death: true
  keep-items-on-death: false
```

If `drop-items-on-death: true`:

Drop the fake player's carried items and equipped armor at the death location.

If `keep-items-on-death: true`:

Keep the items in the fake player's inventory.

Never duplicate items.

Never silently destroy custom item data.

Preserve all supported item metadata when dropping.

---

# 23. FAKE PLAYER NAME CHANGE

Add:

`/np player  `

Example:

`/np player Bot1 NaitikBot`

Change the fake player's visible name from:

`Bot1`

to:

`NaitikBot`

The name must update for currently connected players.

The internal UUID must remain unchanged.

Do not recreate/despawn the fake player just to change its name.

The following must remain unchanged:

* Armor.
* Items.
* Inventory.
* Effects.
* Health.
* AI state.
* Follow target.
* Combat target.
* Location.

Validate the new name according to the target Minecraft version's player-name limitations.

---

# 24. EFFECT SYSTEM

Commands:

`/np effect  `

`/np effect remove  `

`/np effect clear `

Support effects such as:

* Invisibility.
* Speed.
* Strength.
* Jump Boost.
* Regeneration.
* Resistance.
* Fire Resistance.
* Night Vision.
* Haste.

Example:

`/np effect invisibility Bot1`

The fake player should become invisible while continuing to function normally.

---

# 25. AI STATES

Use a proper state system:

```text id="j8x6mv"
IDLE
WALKING
FOLLOWING
FIGHTING
MOVING
STOPPED
```

Examples:

```text id="y2c6wq"
/np walk Bot1
โ†’ WALKING

/np follow Bot1 Naitik
โ†’ FOLLOWING

/np fight Bot1 Naitik
โ†’ FIGHTING

/np give Bot1 100 65 -200
โ†’ MOVING

/np stop Bot1
โ†’ STOPPED
```

Only one primary movement/combat state should control a bot at a time.

---

# 26. ACTION PRIORITY

If Bot1 is walking:

`/np walk Bot1`

and then:

`/np follow Bot1 Naitik`

Walking must stop and following must start.

If Bot1 is following:

`/np follow Bot1 Naitik`

and then:

`/np fight Bot1 Naitik`

Following must stop and fighting must start.

If:

`/np stop Bot1`

is used, all active movement/combat tasks must stop.

---

# 27. STOP COMMAND

Command:

`/np stop `

Immediately stop:

* Walking.
* Following.
* Fighting.
* Movement AI.
* Attack AI.

The bot must remain spawned.

---

# 28. MULTIPLE BOT SUPPORT

Support multiple fake players simultaneously.

Example:

```text id="5f2ep4"
/np spawn 5

/np walk Bot1
/np walk Bot2 20
/np follow Bot3 Naitik
/np fight Bot4 Naitik
```

Each bot must have independent:

* AI.
* State.
* Target.
* Movement speed.
* Combat cooldown.
* Inventory.
* Equipment.
* Effects.

---

# 29. PERFORMANCE

Optimize the plugin for multiple bots.

Configuration:

```yaml id="7mxn9s"
ai:
  update-interval: 2
  path-update-interval: 5
```

Do not perform expensive pathfinding every tick.

Recalculate only when needed:

* Target moved significantly.
* Path becomes invalid.
* Bot gets stuck.
* Destination is reached.
* Target changes.
* AI state changes.

Properly cancel all tasks when a bot is removed.

Prevent:

* Memory leaks.
* Duplicate tasks.
* Duplicate attack loops.
* Excessive pathfinding.
* Console spam.

---

# 30. CONFIGURATION

Create a complete `config.yml`:

```yaml id="q3x5ae"
fake-player:
  max-count: 50
  health: 20.0
  invulnerable: false
  collision: true

movement:
  default-walk-speed: 0.30
  max-walk-speed: 1.00
  default-follow-speed: 0.32
  default-combat-speed: 0.34
  follow-distance: 2.5

walk:
  enabled: true
  radius: 15
  min-walk-time: 3
  max-walk-time: 8
  pause-min: 1
  pause-max: 3

combat:
  attack-range: 3.0
  attack-damage: 5.0
  attack-cooldown: 0.7
  realistic-attacks: true
  critical-hits: true
  critical-hit-chance: 0.35

inventory:
  drop-items-on-death: true
  keep-items-on-death: false

ai:
  update-interval: 2
  path-update-interval: 5
```

---

# 31. PERMISSIONS

Add:

```text id="s1j9xp"
naitikrec.spawn
naitikrec.remove
naitikrec.control
naitikrec.armor
naitikrec.hand
naitikrec.inventory
naitikrec.effect
naitikrec.combat
naitikrec.name
naitikrec.admin
```

Every command must check the appropriate permission.

---

# 32. TAB COMPLETION

Implement proper tab completion.

Support:

* Main commands.
* Fake-player names.
* Online-player names.
* Effects.
* Armor slots.
* Item names where practical.
* Walk/fight/follow arguments.

Examples:

`/np follow Bot1 `

โ†’ Online players.

`/np fight `

โ†’ Fake players.

`/np armor Bot1 `

โ†’ helmet, chestplate, leggings, boots.

---

# 33. ERROR HANDLING

Provide clean messages for:

* Fake player not found.
* Player not online.
* Invalid coordinates.
* Invalid speed.
* Invalid radius.
* Invalid effect.
* No permission.
* Maximum bot limit reached.
* Empty armor slot.
* Empty main hand.
* Invalid command.

Do not spam stack traces into normal server console for expected user errors.

---

# 34. FINAL COMMAND LIST

The final plugin must support:

```text id="z7q4l2"
/np spawn 

/np remove 
/np remove all

/np list
/np help

/np give    

 /np walk 
/np walk  
/np walk speed  

/np follow  

/np fight  

/np stop 

/np armor 
/np armor  helmet
/np armor  chestplate
/np armor  leggings
/np armor  boots

/np cleararmor 

/np hand 
/np clearhand 

/np inventory 

/np player  

/np effect  
/np effect remove  
/np effect clear 
```

---

# 35. REQUIRED TESTING

Before considering the plugin complete, test all of the following.

### Test 1 โ€” Spawn

```text id="x6i0k7"
/np spawn 1
```

Bot1 must spawn and remain spawned.

### Test 2 โ€” Custom Armor

```text id="q7l1va"
/np armor Bot1
```

Bot1 must wear the exact custom armor currently worn by the sender.

### Test 3 โ€” Custom Hand Item

```text id="3m9vkn"
/np hand Bot1
```

Bot1 must hold the exact custom item currently held by the sender.

### Test 4 โ€” Random Walk

```text id="k8z2m4"
/np walk Bot1
```

Bot1 must physically walk around nearby safe locations.

### Test 5 โ€” Walk Speed

```text id="f0s6jd"
/np walk speed Bot1 0.50
```

Bot1's movement speed must immediately increase and remain applied.

### Test 6 โ€” Follow

```text id="n2p7qa"
/np follow Bot1 PlayerName
```

Bot1 must physically chase and follow PlayerName.

### Test 7 โ€” Fight

```text id="a5r8we"
/np fight Bot1 PlayerName
```

Bot1 must physically chase PlayerName, face them, reach attack range, wait for cooldown, and deal actual damage.

### Test 8 โ€” Critical Hits

During combat, Bot1 must be capable of performing valid/natural critical hits when the configured combat conditions are met.

### Test 9 โ€” Name Change

```text id="e7t3px"
/np player Bot1 NaitikBot
```

Bot1's visible name must change without despawning or resetting the bot.

### Test 10 โ€” Effects

```text id="u4k9zc"
/np effect invisibility Bot1
```

Bot1 becomes invisible and continues functioning.

### Test 11 โ€” Stop

```text id="b6n2sx"
/np stop Bot1
```

Bot1 stops all movement/combat but remains spawned.

### Test 12 โ€” Inventory/Death

Give Bot1 custom items and armor, then kill Bot1.

If item dropping is enabled, the items must drop correctly with their custom data preserved.

### Test 13 โ€” Remove

```text id="r3m8vd"
/np remove Bot1
```

Bot1 must be removed and all related AI tasks/resources must be cleaned up.

---

# 36. NON-NEGOTIABLE REQUIREMENT

Do not create fake commands that only send success messages.

Every feature must produce the actual in-game result.

`/np spawn` โ†’ real persistent fake player.

`/np walk` โ†’ real physical walking.

`/np walk speed` โ†’ actual movement-speed change.

`/np follow` โ†’ actual following.

`/np fight` โ†’ actual chasing and attacking.

`/np armor` โ†’ exact custom armor copy.

`/np hand` โ†’ exact custom item copy.

`/np inventory` โ†’ actual inventory management where supported.

`/np player` โ†’ actual visible name change.

`/np effect` โ†’ actual effects.

`/np stop` โ†’ actual AI stop.

`/np remove` โ†’ proper cleanup.

The fake player should feel as close as reasonably possible to a real Minecraft player while remaining a server-side NPC.

If the current fake-player implementation cannot reliably support real movement, following, combat, inventory, or name changes, **refactor the implementation or use a proper Paper/Spigot-compatible NPC/fake-player architecture** rather than leaving features non-functional.

Do not break any already working feature.

Final system:

**SPAWN โ†’ STAY โ†’ WALK โ†’ CUSTOM SPEED โ†’ FOLLOW โ†’ FIGHT โ†’ NATURAL CRITS โ†’ CUSTOM ARMOR โ†’ CUSTOM ITEMS โ†’ INVENTORY โ†’ EFFECTS โ†’ NAME CHANGE โ†’ STOP โ†’ DROP ITEMS โ†’ REMOVE**
Kodari AI
KodariAug 15 at 6:14 pm 3
NaitikRec
Creates persistent server-side fake player NPCs that spawn, walk, follow, fight, wear custom armor, hold custom items, use effects, change names, manage inventories, drop items, stop, and remove. Features independent AI states, realistic combat with natural critical hits, configurable movement speeds, and full command/tab-completion support with permissions.
  1. Create the Gradle/plugin resources and complete command/permission configuration.

  2. Implement the persistent fake-player manager, AI movement, following, combat, equipment, effects, inventory, and cleanup.

  3. Register listeners and tab completion, then wire all commands to real in-game actions.

Created the complete NaitikRec project with:

  • Persistent fake-player manager and UUID/entity tracking.

  • /np command suite with permissions and tab completion.

  • Spawn, remove, list, teleport, walk, follow, fight, stop, rename, effects, armor, hand items, and inventory management.

  • Independent AI states, movement speed, targets, combat cooldowns, critical-hit behavior, and cleanup.

  • Custom item/armor preservation and configurable death drops.

  • Full plugin.yml, config.yml, Gradle build, listeners, and Lombok-backed data model.

Important platform limitation: pure Spigot/Paper API cannot create a genuine server-side Player entity without version-specific NMS or an NPC library. This implementation uses persistent, humanoid Zombie-backed NPCs, providing the requested movement, combat, equipment, health, effects, names, inventory, and lifecycle behavior. True player skins and packet-level fake-player semantics would require adding a dedicated NMS/ProtocolLib/Citizens architecture.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
11 1,112
src/main/java/com/naitikrec/NaitikRec.java
package com.naitikrec;

import com.naitikrec.command.NaitikRecCommand;
import com.naitikrec.listener.FakePlayerListener;
import com.naitikrec.manager.FakePlayerManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class NaitikRec extends JavaPlugin {
    private FakePlayerManager fakePlayerManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        fakePlayerManager = new FakePlayerManager(this);
        Bukkit.getPluginManager().registerEvents(new FakePlayerListener(fakePlayerManager), this);

        NaitikRecCommand command = new NaitikRecCommand(fakePlayerManager);
        if (getCommand("np") != null) {
            getCommand("np").setExecutor(command);
            getCommand("np").setTabCompleter(command);
        }
    }

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