pixel_856
๐Ÿ“Ž 1 file 18,819 chars
๐Ÿ“„
pasted-code-1786818099831.txt
txt 1178 lines
โ–ถ
# NaitikRec โ€” Complete Fake Player / Player NPC Plugin

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

The purpose of this plugin is to create **actual player-model fake players/NPCs**, NOT zombies, skeletons, armor stands, villagers, or other mobs.

The fake player must visually look and behave as close as reasonably possible to a **real Minecraft player**.

## CRITICAL REQUIREMENT โ€” ACTUAL PLAYER MODEL

When executing:

`/np spawn 1`

the result MUST be an actual **player-looking NPC/fake player**.

### DO NOT USE:

* Zombie
* Skeleton
* Husk
* Villager
* Armor Stand
* Any mob disguised as a player
* Any mob with a player skin
* A normal mob with renamed name
* A mob-based workaround

The spawned entity must have:

* Real player model/body
* Player skin
* Player head
* Player arms
* Player legs
* Player hitbox
* Player animations where supported
* Player equipment slots
* Player-like movement
* Player-like combat

If the current implementation produces a zombie, **replace/refactor that implementation completely**.

Use a proper **server-side fake-player/NPC implementation compatible with the target Paper/Spigot version**. If NMS or ProtocolLib is required, implement it correctly and include the required dependency/setup.

---

# 1. FAKE PLAYER CORE

Each fake player must have:

* Unique UUID
* Unique entity ID
* Visible player name
* Player skin
* Player model
* Player hitbox
* Health
* Inventory
* Armor slots
* Main hand
* Offhand
* Potion effects
* Movement controller
* Combat controller
* AI state
* Current target
* Individual movement speed
* Attack cooldown

Each fake player must be independently controlled.

---

# 2. SPAWN

Command:

`/np spawn `

Example:

`/np spawn 5`

Spawn 5 actual player-model fake players at the command sender's location.

Default generated names:

```text
Bot1
Bot2
Bot3
Bot4
Bot5
```

Names must be unique.

### Spawn Persistence

After:

`/np spawn 1`

the fake player must remain spawned.

It must NOT automatically disappear after:

* 1 second
* 5 seconds
* A scheduled task ending
* Losing a reference
* A fake connection timeout
* Being treated as a temporary entity

The fake player should remain until:

`/np remove `

or:

`/np remove all`

is used.

---

# 3. PLAYER APPEARANCE

The fake player must look like a real Minecraft player.

Support:

* Player skin
* Player name
* Player model
* Armor
* Held items
* Offhand
* Player animations where possible

Allow a configurable default skin.

If skin support requires a specific implementation, use the correct implementation for the selected Minecraft version.

---

# 4. REMOVE

Commands:

`/np remove `

`/np remove all`

Removing a bot must:

* Remove the fake player from all players' view.
* Stop all AI tasks.
* Stop movement.
* Stop combat.
* Clear targets.
* Remove scheduled tasks.
* Clean entity/UUID references.
* Prevent memory leaks.

---

# 5. LIST

Command:

`/np list`

Display all spawned fake players and their current state.

Example:

```text
Bot1 โ€” IDLE
Bot2 โ€” WALKING
Bot3 โ€” FOLLOWING
Bot4 โ€” FIGHTING
```

---

# 6. HELP

Command:

`/np help`

Show all available commands.

---

# 7. POSITION / TELEPORT

Command:

`/np give    `

Example:

`/np give Bot1 100 65 -200`

Teleport the fake player to the specified coordinates.

The bot must remain fully functional after teleporting.

---

# 8. WALK SYSTEM

Command:

`/np walk `

Example:

`/np walk Bot1`

The fake player must physically walk around the nearby area.

It must NOT:

* Stand permanently still
* Only play walking animations
* Constantly teleport
* Move randomly through solid blocks

It should:

* Select random safe destinations.
* Walk toward destinations.
* Turn naturally.
* Stop briefly.
* Select another destination.
* Continue walking.
* Avoid obstacles.
* Jump over simple one-block obstacles.
* Avoid lava and void.
* Avoid getting permanently stuck.

---

# 9. WALK RADIUS

Command:

`/np walk  `

Example:

`/np walk Bot1 20`

The bot should walk within approximately 20 blocks of its walking area.

Default:

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

Select only reasonably safe destinations.

---

# 10. WALK SPEED

Add:

`/np walk speed  `

Examples:

`/np walk speed Bot1 0.35`

`/np walk speed Bot1 0.50`

This must actually change the fake player's movement speed.

The speed must:

* Apply immediately.
* Be stored per fake player.
* Work during `/np walk`.
* Work during follow/combat movement where appropriate.
* Not reset when changing AI state.
* Have a configurable maximum.

Configuration:

```yaml
movement:
  default-walk-speed: 0.30
  max-walk-speed: 1.00
  default-follow-speed: 0.32
  default-combat-speed: 0.34
```

Reject invalid or negative speeds.

---

# 11. FOLLOW

Command:

`/np follow  `

Example:

`/np follow Bot1 Naitik`

The fake player must **actually walk/run toward and follow the real player**.

Requirements:

* Continuously update target location.
* Move toward target.
* Face target.
* Maintain follow distance.
* Follow target when moving.
* Follow target when changing direction.
* Jump over simple obstacles.
* Avoid getting stuck.
* Do not constantly teleport.

The bot must physically move.

---

# 12. FOLLOW AI

Use a repeating AI controller.

The controller should:

1. Check fake player.
2. Check target.
3. Get latest target location.
4. Update path/direction.
5. Move toward target.
6. Rotate toward target.
7. Detect if stuck.
8. Recalculate path when needed.

Do not run expensive pathfinding every tick.

---

# 13. FIGHT

Command:

`/np fight  `

Example:

`/np fight Bot1 Naitik`

The bot must actually:

1. Select target.
2. Chase target.
3. Face target.
4. Reach attack range.
5. Wait for attack cooldown.
6. Attack.
7. Deal real damage.
8. Continue chasing if target moves.
9. Attack again after cooldown.

Do not simply make the bot look at the player.

---

# 14. REALISTIC COMBAT

Do NOT spam attacks.

Configuration:

```yaml
combat:
  attack-range: 3.0
  attack-damage: 5.0
  attack-cooldown: 0.7
  realistic-attacks: true
```

The bot should attack at realistic intervals.

Do not attack every tick.

---

# 15. CRITICAL HIT SYSTEM

When fighting, the fake player must be capable of performing **actual natural Minecraft critical hits**.

Configuration:

```yaml
combat:
  critical-hits: true
  critical-hit-chance: 0.35
```

Requirements:

* Do not make every attack critical.
* Do not simply multiply damage to fake a critical.
* The bot should perform appropriate jumping/falling behavior.
* The attack should occur under valid Minecraft critical-hit conditions.
* Respect normal attack cooldown.
* Continue normal movement between attacks.

Example:

```text
CHASE
โ†“
MOVE INTO RANGE
โ†“
JUMP / FALL
โ†“
ATTACK WHILE FALLING
โ†“
NATURAL CRITICAL HIT
โ†“
CONTINUE COMBAT
```

If `critical-hits: false`, disable intentional critical-hit behavior.

---

# 16. COMBAT MOVEMENT

While fighting:

* Chase target.
* Face target.
* Maintain attack distance.
* Update target position.
* Jump when appropriate.
* Handle simple obstacles.
* Avoid getting stuck.
* Do not constantly teleport.

---

# 17. COMBAT ROTATION

The fake player should:

* Face the target.
* Rotate body naturally.
* Rotate head toward target.
* Avoid random spinning.
* Avoid extremely unnatural instant rotation.
* Face the target before attacking.

---

# 18. CUSTOM ARMOR

Command:

`/np armor `

Example:

`/np armor Bot1`

Copy the command sender's currently equipped armor.

Copy:

* Helmet
* Chestplate
* Leggings
* Boots

The fake player must visually wear the exact same items.

---

# 19. CUSTOM ARMOR DATA

Do NOT limit armor to Diamond/Netherite.

Clone the actual `ItemStack`.

Preserve all supported data:

* 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.

---

# 20. INDIVIDUAL ARMOR

Support:

`/np armor  helmet`

`/np armor  chestplate`

`/np armor  leggings`

`/np armor  boots`

Copy the selected armor slot from the command sender.

---

# 21. CUSTOM HAND ITEM

Command:

`/np hand `

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

Preserve:

* Enchantments
* Name
* Lore
* CustomModelData
* Attributes
* Durability
* Item flags
* PersistentDataContainer
* Supported NBT/data components

The bot must visibly hold the exact custom item.

---

# 22. CLEAR EQUIPMENT

Commands:

`/np cleararmor `

`/np clearhand `

---

# 23. INVENTORY

Command:

`/np inventory `

Provide a proper fake-player inventory system where supported by the chosen implementation.

The inventory should support:

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

---

# 24. INVENTORY DROP

When the fake player dies, handle inventory correctly.

Configuration:

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

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

* Drop carried items.
* Drop equipped armor.
* Drop them at the death location.
* Preserve custom item data.
* Do not duplicate items.

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

* Keep items instead of dropping them.

Custom items must retain their:

* Enchantments
* Name
* Lore
* CustomModelData
* Attributes
* Durability
* Supported NBT/data components

---

# 25. PLAYER NAME CHANGE

Command:

`/np player  `

Example:

`/np player Bot1 NaitikBot`

Change the fake player's visible name to `NaitikBot`.

Requirements:

* Update the name for currently connected players.
* Do not change internal UUID.
* Do not despawn the bot.
* Do not recreate the bot.
* Do not reset armor.
* Do not reset inventory.
* Do not reset effects.
* Do not reset AI.
* Do not reset health.
* Do not reset target.

Validate the new name according to the target Minecraft version.

---

# 26. EFFECT SYSTEM

Commands:

`/np effect  `

`/np effect remove  `

`/np effect clear `

Support:

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

Example:

`/np effect invisibility Bot1`

The bot becomes invisible while continuing to work.

---

# 27. AI STATES

Use:

```text
IDLE
WALKING
FOLLOWING
FIGHTING
MOVING
STOPPED
```

Examples:

```text
/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 AI state controls the bot at a time.

---

# 28. ACTION PRIORITY

If a bot is walking:

`/np walk Bot1`

then:

`/np follow Bot1 Naitik`

Walking must stop and following must start.

If following and:

`/np fight Bot1 Naitik`

is used, following must stop and fighting must start.

If:

`/np stop Bot1`

is used, all movement and combat tasks must stop.

---

# 29. STOP

Command:

`/np stop `

Stop:

* Walk AI
* Follow AI
* Combat AI
* Attack task
* Movement task

The bot must remain spawned.

---

# 30. MULTIPLE BOTS

Support multiple bots simultaneously.

Example:

```text
/np spawn 5

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

Every bot must have independent:

* State
* Target
* Speed
* Inventory
* Armor
* Effects
* AI
* Combat cooldown

---

# 31. PERFORMANCE

Optimize the plugin.

Configuration:

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

Do not perform expensive pathfinding every tick.

Recalculate only when needed.

Properly cancel tasks when:

* Bot removed
* State changed
* Target disconnects
* Plugin disables

Prevent:

* Memory leaks
* Duplicate AI loops
* Duplicate attack loops
* Excessive pathfinding
* Console spam

---

# 32. CONFIG.YML

Create:

```yaml
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
```

---

# 33. PERMISSIONS

Add:

```text
naitikrec.spawn
naitikrec.remove
naitikrec.control
naitikrec.armor
naitikrec.hand
naitikrec.inventory
naitikrec.effect
naitikrec.combat
naitikrec.name
naitikrec.admin
```

---

# 34. TAB COMPLETION

Add tab completion for:

* Commands
* Fake-player names
* Online-player names
* Effects
* Armor slots
* Item names
* Walk arguments
* Fight arguments
* Follow arguments

Examples:

`/np follow Bot1 `

โ†’ online players.

`/np fight `

โ†’ fake players.

`/np armor Bot1 `

โ†’ helmet, chestplate, leggings, boots.

---

# 35. ERROR HANDLING

Handle:

* Fake player not found.
* Target player offline.
* Invalid coordinates.
* Invalid speed.
* Invalid radius.
* Invalid effect.
* No permission.
* Maximum fake-player limit.
* Empty armor slot.
* Empty hand.
* Invalid name.
* Invalid command.

Use clean messages and avoid unnecessary console errors.

---

# 36. COMPLETE COMMAND LIST

```text
/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 
```

---

# 37. MANDATORY TESTING

Before declaring the plugin complete, test:

### Spawn

```text
/np spawn 1
```

Must create an **actual player-model fake player**, NOT a zombie.

### Multiple Spawn

```text
/np spawn 5
```

All 5 must appear as player-model NPCs.

### Armor

```text
/np armor Bot1
```

Must copy the sender's exact custom armor.

### Hand

```text
/np hand Bot1
```

Must copy the exact custom item.

### Walk

```text
/np walk Bot1
```

Bot1 physically walks around.

### Walk Radius

```text
/np walk Bot1 20
```

Bot1 walks within the selected radius.

### Walk Speed

```text
/np walk speed Bot1 0.50
```

Bot1's movement speed visibly changes.

### Follow

```text
/np follow Bot1 PlayerName
```

Bot1 physically follows PlayerName.

### Fight

```text
/np fight Bot1 PlayerName
```

Bot1 physically chases PlayerName and attacks.

### Critical Hit

During combat, Bot1 must be capable of performing valid natural critical hits rather than simply applying fake critical damage.

### Name

```text
/np player Bot1 NaitikBot
```

Bot1's visible name changes without recreating the bot.

### Inventory

```text
/np inventory Bot1
```

Inventory/equipment must function according to the chosen NPC implementation.

### Effects

```text
/np effect invisibility Bot1
```

Bot1 becomes invisible and continues functioning.

### Stop

```text
/np stop Bot1
```

Bot1 stops all movement/combat but stays spawned.

### Death/Drop

Kill the bot while carrying custom items.

If drops are enabled, custom items and armor must drop correctly.

### Remove

```text
/np remove Bot1
```

Bot1 is completely removed and all tasks/resources are cleaned up.

---

# 38. FINAL NON-NEGOTIABLE REQUIREMENTS

The implementation must **NOT use zombies or other mobs as fake players**.

The visual result of `/np spawn` must be an actual **Minecraft player-model NPC**.

The following must all work as real in-game functionality:

**Spawn**
โ†’ Actual player-model NPC

**Stay**
โ†’ Does not automatically despawn

**Walk**
โ†’ Physically walks around

**Walk Speed**
โ†’ `/np walk speed` actually changes speed

**Follow**
โ†’ Physically follows a real player

**Fight**
โ†’ Physically chases and attacks

**Critical Hits**
โ†’ Performs valid natural Minecraft critical attacks

**Custom Armor**
โ†’ Copies the exact armor ItemStacks

**Custom Hand**
โ†’ Copies the exact custom held ItemStack

**Inventory**
โ†’ Has usable inventory/equipment where supported

**Inventory Drop**
โ†’ Drops items correctly on death

**Effects**
โ†’ Actually applies effects

**Name Change**
โ†’ Changes visible player name without recreating the NPC

**Stop**
โ†’ Stops movement/combat while keeping the bot spawned

**Remove**
โ†’ Completely removes the bot and cleans up all resources

Do not return placeholder implementations.

Do not implement `/np follow`, `/np fight`, or `/np walk` as messages only.

Do not use constant teleportation to simulate movement.

Do not replace the fake player with a zombie, skeleton, villager, armor stand, or other mob.

Use a proper **Paper/Spigot-compatible player-NPC/fake-player architecture** and clearly specify the required Minecraft version and dependencies.

The final plugin must be stable, optimized, modular, and actually usable on a live Minecraft server.
Kodari AI
KodariAug 15 at 6:25 pm 3
NaitikRec
A production-ready Paper/Spigot plugin that spawns actual player-model fake players (NPCs) using server-side player entity packets. Each NPC has a real player skin, hitbox, equipment, and behavior. Commands control walking, following, fighting with natural critical hits, custom armor/hand items, effects, teleportation, and name changes. NPCs persist until removed, support individual AI states, and feature configurable movement, combat, and AI settings with full permission and tab-completion support.
  1. Build a Paper 1.20.4 Java 17 plugin with Citizens-backed player NPCs, avoiding mob disguises.

  2. Add persistent bot management, movement/follow/combat AI, natural attack attempts, equipment/effects, death drops, and cleanup.

  3. Add the /np command tree, permissions, tab completion, configuration, and Citizens runtime setup.

The initial source set is in place. Iโ€™m correcting the two compile/runtime issues that are visible before handing it off: Lombok must be available for the model accessors, and the effect command needs the documented remove <effect> <fakeplayer> argument order handled correctly.Implemented the new NaitikRec project from scratch.

  • Paper 1.20.4 / Java 17 Gradle project.

  • Citizens-backed actual player-model NPCs; no zombies, armor stands, or mob disguises.

  • Persistent NPC spawning/removal with unique names.

  • /np command suite with permissions and tab completion.

  • Walking, following, combat, configurable movement speeds, attack cooldowns, and critical-hit attempts.

  • Armor, hand items, inventory access, effects, name changes, teleportation, stop controls, and death drops.

  • Configuration for limits, AI intervals, movement, combat, inventory, and appearance.

  • Citizens dependency is validated at startup and NPCs are cleaned up on shutdown.

Required server dependency:

Plain Text
Paper 1.20.4
Java 17
Citizens

Important limitation: Citizens provides the player-model NPC architecture, while true vanilla client-side player behavior and skin visibility depend on the installed Citizens version and server configuration.

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

import com.naitikrec.command.NPCommand;
import com.naitikrec.listener.BotListener;
import com.naitikrec.manager.BotManager;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public final class NaitikRec extends JavaPlugin {
    private BotManager botManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        if (!BotManager.isCitizensAvailable()) {
            getLogger().severe("Citizens is required. Install Citizens before using NaitikRec.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        botManager = new BotManager(this);
        NPCommand command = new NPCommand(this, botManager);
        PluginCommand np = getCommand("np");
        if (np == null) {
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        np.setExecutor(command);
        np.setTabCompleter(command);
        Bukkit.getPluginManager().registerEvents(new BotListener(botManager), this);
        getLogger().info("NaitikRec enabled with Citizens player NPC support.");
    }

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