pixel_856
📎 1 file 8,284 chars
📄
pasted-code-1786814869443.txt
txt 405 lines
▶
# NaitikRec — Complete Minecraft Fake Player Plugin

Create a complete **Minecraft Java Paper/Spigot plugin** named **`NaitikRec`** that adds realistic, controllable fake players/NPCs to the server.

The plugin should be optimized, modular, and production-ready. All fake players must be **server-side NPC/fake players**, not real Minecraft accounts.

## 1. Main Commands

### Spawn

`/np spawn `

* Spawn the specified number of fake players.
* Spawn them at the command sender's current location.
* Automatically generate unique names such as `Bot1`, `Bot2`, `Bot3`, etc.
* Support spawning multiple fake players without unnecessary server lag.

### Remove

`/np remove `

Remove a specific fake player.

`/np remove all`

Remove all fake players.

### List

`/np list`

Show all currently spawned fake players.

### Help

`/np help`

Display all available NaitikRec commands.

---

## 2. Fake Player Appearance

Every fake player should:

* Look like a normal Minecraft player.
* Have a proper player model and hitbox.
* Have a customizable name.
* Be visible to normal players.
* Be targetable by players and mobs.
* Support player skins if the implementation allows it.
* Be able to hold items.
* Be able to wear armor.

---

## 3. Armor System

Command:

`/np armor  `

Examples:

`/np armor Bot1 diamond`

`/np armor Bot1 netherite`

`/np armor Bot1 iron`

The fake player should visually equip the selected armor set.

Also support individual armor pieces if possible:

`/np armor Bot1 diamond_helmet`

`/np armor Bot1 diamond_chestplate`

`/np armor Bot1 diamond_leggings`

`/np armor Bot1 diamond_boots`

The armor should actually appear on the fake player's model.

---

## 4. Movement & Position

### Follow

`/np follow  `

Example:

`/np follow Bot1 Naitik`

The fake player should continuously follow the selected real player.

Requirements:

* Smooth movement.
* Slightly faster movement speed than a normal player.
* No constant stopping/jittering.
* Proper pathfinding around obstacles.
* Do not teleport constantly unless absolutely necessary.
* Keep a reasonable following distance.

### Move to Position

`/np give    `

Example:

`/np give Bot1 100 65 -200`

Move/teleport the fake player to the specified coordinates.

---

## 5. Combat System

### Fight

`/np fight  `

Example:

`/np fight Bot1 Naitik`

The fake player should attack the selected player using realistic Minecraft combat behavior.

### Realistic Attack Timing

This is very important:

* **Do NOT spam attacks.**
* Add a proper attack cooldown.
* Attack timing should feel like a real Minecraft player.
* The fake player should not rapidly hit every tick.
* Attack speed should be configurable in `config.yml`.

### Critical Hits

The fake player should be capable of performing **critical hits naturally**.

Do not force critical hits on every attack.

Use appropriate Minecraft conditions for a critical hit, such as the fake player being airborne/falling when attacking.

The combat system should feel natural rather than like an automated hit-spam bot.

### Combat Movement

While fighting:

* Move toward the target.
* Maintain reasonable attack distance.
* Turn toward the target.
* Follow the target if they move.
* Attack only when the attack cooldown is ready.
* Avoid jittery or unnatural movement.

### Stop Fighting

`/np stop `

Stop the fake player's current action, including fighting or following.

---

## 6. Fake Player Effects

Add:

`/np effect  `

Example:

`/np effect invisibility Bot1`

Support common potion effects:

* `invisibility`
* `speed`
* `strength`
* `jump_boost`
* `regeneration`
* `resistance`
* `fire_resistance`
* `night_vision`
* `haste`

Remove an effect:

`/np effect remove  `

Clear all effects:

`/np effect clear `

Effects should properly affect the fake player's behavior and appearance.

For example, an invisible fake player should actually become invisible to normal players while continuing to function normally.

---

## 7. Item System

Add:

`/np giveitem   [amount]`

Example:

`/np giveitem Bot1 diamond_sword 1`

The fake player should receive the specified item.

Also allow the item to be equipped in the main hand where appropriate.

---

## 8. Fake Player AI

The fake player should have basic AI for:

* Following players.
* Fighting players.
* Moving toward coordinates.
* Looking at targets.
* Turning toward enemies.
* Maintaining attack distance.
* Basic obstacle avoidance.
* Natural movement.

The AI should be optimized and should not create unnecessary server load.

---

## 9. Configuration

Create a `config.yml` with configurable settings such as:

* Maximum fake players.
* Default health.
* Movement speed.
* Follow speed.
* Attack damage.
* Attack range.
* Attack cooldown.
* Combat difficulty.
* Pathfinding settings.
* Default skin.
* Collision.
* Invulnerability.
* AI enabled/disabled.

Example configuration structure:

```yaml
fake-player:
  max-count: 50
  health: 20.0
  movement-speed: 0.30
  attack-damage: 5.0
  attack-range: 3.0
  attack-cooldown: 0.7

combat:
  realistic-attacks: true
  critical-hits: true
  attack-spam: false

movement:
  follow-speed: 0.32
  smooth-movement: true
```

---

## 10. Permissions

Add permissions:

* `naitikrec.spawn`
* `naitikrec.remove`
* `naitikrec.control`
* `naitikrec.armor`
* `naitikrec.effect`
* `naitikrec.combat`
* `naitikrec.admin`

Make permission checks work for every command.

---

## 11. Tab Completion

Add proper tab completion for:

* Fake player names.
* Online player names.
* Armor types.
* Effect names.
* Subcommands.
* Item names where practical.

Example:

`/np fight `

should show available fake players.

`/np follow Bot1 `

should show online players.

---

## 12. Performance & Stability

The plugin must be optimized for Minecraft servers.

* Avoid unnecessary repeating tasks.
* Avoid excessive pathfinding calculations.
* Do not run expensive AI calculations every tick unless required.
* Properly clean up tasks when a fake player is removed.
* Prevent memory leaks.
* Handle fake-player death/removal safely.
* Support multiple fake players simultaneously.
* Do not interfere with normal players.
* Avoid console spam.
* Handle invalid commands gracefully.

---

## 13. Command Structure

The final command system should include:

```text
/np spawn 
/np remove 
/np remove all
/np list
/np help

/np armor  

/np follow  

/np give    

/np fight  

/np stop 

/np effect  
/np effect remove  
/np effect clear 

/np giveitem   [amount]
```

### Example Usage

```text
/np spawn 5
/np armor Bot1 diamond
/np give Bot1 100 65 -200
/np follow Bot1 Naitik
/np fight Bot1 Naitik
/np stop Bot1

/np effect invisibility Bot1
/np effect speed Bot1
/np effect remove speed Bot1
/np effect clear Bot1

/np giveitem Bot1 diamond_sword 1
/np remove Bot1
```

## 14. Plugin Files

Provide a complete working plugin including:

* `plugin.yml`
* `config.yml`
* Main plugin class.
* Command system.
* Tab completer.
* Fake-player/NPC manager.
* Movement/follow system.
* Combat AI.
* Armor/equipment system.
* Effect system.
* Permission system.
* Proper event handling.
* Clean modular project structure.

Make sure the plugin is **actually functional**, not just a command framework. The fake players must visibly spawn, move, follow, wear armor, receive effects, and fight realistically.

**Target:** Minecraft Java Edition Paper/Spigot. Make the implementation compatible with the target Minecraft version and clearly state any required dependencies/API limitations.
Kodari AI
KodariAug 15 at 5:29 pm 2
NaitikRec
A comprehensive Minecraft Paper/Spigot plugin that spawns realistic, controllable fake players (NPCs) with full AI capabilities. Features include spawning multiple fake players with unique names, customizable armor sets, smooth follow and movement AI, realistic combat with attack cooldowns and critical hits, potion effects, item equipping, and configurable settings. Includes complete command system with tab completion, permission checks, and optimized performance to prevent server lag. Fake players are fully visible, targetable, and interact naturally with the game world.
  1. Create the Gradle project and plugin metadata with Citizens as the runtime NPC dependency.

  2. Add the reflective Citizens integration, fake-player model/manager, scheduled movement/combat AI, and equipment/effect handling.

  3. Add the /np command executor, tab completion, event cleanup, and configurable permissions/settings.

Created the complete NaitikRec plugin project.

  • Added Gradle project configuration and plugin metadata.

  • Implemented Citizens-based fake player spawning with skins, names, hitboxes, equipment, health, collision, and invulnerability settings.

  • Added configurable follow, movement, combat, attack cooldowns, critical-hit behavior, and basic obstacle avoidance.

  • Implemented armor, item, potion effect, cleanup, death handling, and player-quit handling.

  • Added /np commands, permissions, validation, and tab completion.

  • Added configurable config.yml.

Required dependency: Citizens must be installed on the server. The plugin uses Citizens NPCs rather than real Minecraft accounts.

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

import com.naitikrec.command.NaitikRecCommand;
import com.naitikrec.command.NaitikRecTabCompleter;
import com.naitikrec.listener.NaitikRecListener;
import com.naitikrec.npc.CitizensHook;
import com.naitikrec.npc.FakePlayerManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public final class NaitikRec extends JavaPlugin {
    private FakePlayerManager fakePlayerManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        CitizensHook citizensHook = new CitizensHook(this);
        if (!citizensHook.isAvailable()) {
            getLogger().severe("Citizens was not found. NaitikRec requires Citizens and will be disabled.");
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }

        fakePlayerManager = new FakePlayerManager(this, citizensHook);
        NaitikRecCommand command = new NaitikRecCommand(this, fakePlayerManager);
        if (getCommand("np") != null) {
            getCommand("np").setExecutor(command);
            getCommand("np").setTabCompleter(new NaitikRecTabCompleter(fakePlayerManager));
        }
        Bukkit.getPluginManager().registerEvents(new NaitikRecListener(fakePlayerManager), this);

        long interval = Math.max(1L, getConfig().getLong("movement.tick-interval", 2L));
        Bukkit.getScheduler().runTaskTimer(this, fakePlayerManager::tick, interval, interval);
    }

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