Uzii Verse
πŸ“Ž 1 file 19,211 chars
πŸ“„
pasted-code-1790348235073.txt
txt 1052 lines
β–Ά
CREATE A COMPLETE MINECRAFT PAPER PLUGIN CALLED:

CivilizationNPC

TARGET:
Minecraft Paper 1.21.11
Java 21

IMPORTANT:
This is a FULL standalone plugin.
Do NOT use Citizens.
Do NOT use ArmorStands for NPCs.

==================================================
CORE REQUIREMENT β€” REAL PLAYER-LIKE FAKE NPC
==================================================

The most important requirement of this entire project:

NPCs MUST be REAL PLAYER-LIKE FAKE PLAYER NPCs.

They must visually behave like Minecraft players.

They must have:

- Real player model
- Player skin
- Player head
- Custom username/name above head
- Player body
- Player arms and legs
- Walking animation
- Head rotation
- Body rotation
- Looking around
- Idle behavior
- Walking
- Running when appropriate
- Attack animation
- Hurt animation
- Death animation
- Armor
- Held weapons
- Player-like movement
- Player-like combat

The NPC must appear as a Minecraft player, NOT as an ArmorStand.

==================================================
ABSOLUTELY FORBIDDEN
==================================================

DO NOT USE:

- Citizens
- CitizensAPI
- Citizens NPC Registry
- ArmorStand NPCs
- Villager NPCs
- Zombie NPCs
- Skeleton NPCs
- Any mob disguised as a player
- Any fake ArmorStand player
- Any visual ArmorStand replacement
- Citizens as an optional dependency
- Citizens as a fallback

There must be ZERO Citizens dependency.

There must be ZERO Citizens imports.

There must be ZERO Citizens API calls.

There must be ZERO Citizens references anywhere in the final project.

If Paper API alone cannot create the required player-like fake NPC, use the appropriate Paper 1.21.11-compatible NMS/network/server-side fake-player implementation.

The implementation must be compatible with Paper 1.21.11 and Java 21.

DO NOT silently replace the NPC with another entity.

If the fake-player implementation fails, show a clear error instead of creating an ArmorStand.

==================================================
PLUGIN DEPENDENCIES
==================================================

The plugin must work on a clean Paper 1.21.11 server.

Required:

- Paper 1.21.11
- Java 21

Do NOT require:

- Citizens
- ProtocolLib
- LibsDisguises
- Any external NPC plugin

If a library is absolutely necessary, prefer bundling/shading it inside the plugin so the server administrator does not need to install another plugin.

Do not create a hard dependency on another Minecraft plugin.

==================================================
MAIN PURPOSE
==================================================

This plugin is designed to create large Minecraft civilizations populated by player-like NPCs.

Players should be able to create:

- Civilizations
- NPC citizens
- Guards
- Warriors
- Archers
- Captains
- Commanders
- Kings
- Guard posts
- Patrol routes
- Territories
- Armies
- Civilization wars
- Civilization defenses
- Civilization attacks

The NPCs should behave naturally and make the civilization feel alive.

==================================================
GUI SYSTEM
==================================================

The plugin must be GUI-focused.

The administrator should NOT need to type commands for normal management.

Main command:

/civ

This opens the main Civilization GUI.

==================================================
MAIN GUI
==================================================

Create a clean professional Minecraft inventory GUI.

Main menu buttons:

1. Civilizations
2. NPC Manager
3. Create NPC
4. NPC List
5. Skin Manager
6. Equipment Manager
7. Path Manager
8. Guard Posts
9. Locations
10. Territory
11. Army
12. Combat
13. Statistics
14. Settings

Use Minecraft inventory GUI menus.

Every GUI must have:

- Back button
- Close button
- Next page
- Previous page
- Search where useful
- Confirmation menus for destructive actions

==================================================
NPC MANAGER
==================================================

NPC Manager GUI must allow:

- Create NPC
- Delete NPC
- Edit NPC
- Rename NPC
- Change skin
- Change role
- Change civilization
- Change equipment
- Change weapon
- Teleport NPC
- Freeze NPC
- Unfreeze NPC
- Duplicate NPC
- Respawn NPC
- Assign path
- Assign guard post
- Set behavior
- Set patrol
- Set home location
- Set combat mode

NPC list must support pagination.

Show NPC information such as:

- Name
- Role
- Civilization
- Location
- Current behavior
- Current path
- Health
- Equipment

==================================================
CREATE NPC GUI
==================================================

Create NPC through GUI.

Fields/options:

- NPC name
- Skin
- Role
- Civilization
- Armor
- Weapon
- Location
- Behavior
- Patrol
- Guard post

After confirmation, spawn the fake player NPC.

==================================================
CUSTOM NAMES
==================================================

NPC names must be customizable.

Examples:

King Arman
Captain Zayn
Guard Ali
Warrior Hassan
Villager Omar

Support:

- Color codes
- Prefixes
- Role prefixes
- Civilization prefixes

Example:

[ICE] Captain Zayn

==================================================
SKIN SYSTEM
==================================================

Create a Skin Manager GUI.

Allow:

- Add skin
- Remove skin
- Edit skin
- Select skin
- Assign skin to NPC
- Assign skin to role
- Assign random skin

Support Minecraft skin texture/profile information.

Store skins permanently.

NPC skins must survive server restart.

==================================================
NPC ROLES
==================================================

Include these roles:

CIVILIAN
GUARD
ARCHER
WARRIOR
CAPTAIN
COMMANDER
KING

Each role has different behavior.

CIVILIAN:

- Walk around civilization
- Visit locations
- Random movement
- Social/idle behavior
- Avoid dangerous areas

GUARD:

- Patrol
- Protect civilization
- Protect guard posts
- Attack enemies
- Respond to alarms

ARCHER:

- Maintain distance
- Use bow/crossbow
- Attack enemies from range
- Defend civilization

WARRIOR:

- Melee combat
- Protect civilians
- Patrol
- Attack enemies

CAPTAIN:

- Command nearby guards
- Join combat
- Defend important locations

COMMANDER:

- Control nearby military NPCs
- Lead attacks
- Respond to civilization threats

KING:

- Stay in palace/important location
- Protected by guards
- Can be escorted
- Civilization leader

==================================================
NATURAL NPC BEHAVIOR
==================================================

NPCs should NOT stand completely still.

Add natural behavior:

- Random looking
- Looking at nearby NPCs
- Walking around
- Idle pauses
- Walking to locations
- Returning home
- Patrolling
- Guarding
- Following commanders
- Responding to danger

Add randomized timing so all NPCs do not move at exactly the same time.

==================================================
PATH SYSTEM
==================================================

Create a complete path system.

Path Manager GUI:

- Create Path
- Delete Path
- Rename Path
- Edit Path
- Add Point
- Delete Point
- Move Point
- Finish Path
- Cancel
- Loop
- One Way
- Reverse
- Random Route
- Pause at Point

==================================================
PATH CREATION
==================================================

Allow the administrator to physically walk around the world and create a path.

Example:

Player walks to Point 1
Click "Add Point"

Player walks to Point 2
Click "Add Point"

Player walks to Point 3
Click "Add Point"

Click:

FINISH PATH

NPCs can then follow the path.

==================================================
PATROL SYSTEM
==================================================

Guards can be assigned patrol paths.

Patrol modes:

- Loop
- One Way
- Reverse
- Random

Allow configurable pause time at each point.

Example:

Guard walks:

Point 1
Pause 3 seconds
Point 2
Pause 5 seconds
Point 3
Return to Point 1

==================================================
GUARD POSTS
==================================================

Create Guard Post GUI.

Allow:

- Create Guard Post
- Rename
- Delete
- Assign guards
- Assign patrol
- Set radius
- Set alert radius
- Set priority

Guards should protect their assigned post.

==================================================
CIVILIZATION SYSTEM
==================================================

Create multiple civilizations.

Civilization GUI:

- Create
- Delete
- Rename
- Edit
- NPC members
- Military
- King
- Territory
- Guard posts
- Locations
- Relations
- Statistics

Each civilization can have:

- Name
- Color
- King
- Citizens
- Guards
- Army
- Territory
- Headquarters
- Relations

==================================================
TERRITORY SYSTEM
==================================================

Allow civilizations to have territory.

GUI options:

- Set territory
- Expand territory
- Remove territory
- View territory
- Set headquarters

Display territory boundaries when editing.

==================================================
LOCATIONS
==================================================

Allow named civilization locations:

- Palace
- Village
- Farm
- Mine
- Blacksmith
- Barracks
- Guard Tower
- Gate
- Prison
- Market
- Headquarters

NPC behavior can depend on these locations.

==================================================
ARMY SYSTEM
==================================================

Civilizations can have armies.

Army GUI:

- Create army
- Add NPCs
- Remove NPCs
- Assign commander
- Set formation
- Set target
- Deploy army
- Recall army

==================================================
COMBAT SYSTEM
==================================================

NPCs must be able to fight.

Support:

- Melee combat
- Ranged combat
- Target detection
- Enemy detection
- Attack animations
- Weapon handling
- Armor
- Damage
- Knockback
- Death
- Respawn

NPCs should identify:

- Hostile NPCs
- Hostile civilizations
- Players marked as enemies
- Invaders

==================================================
ALARM SYSTEM
==================================================

Civilizations can enter ALARM mode.

When an enemy enters territory:

- Guards detect enemy
- Alarm activates
- Nearby guards respond
- Soldiers leave patrol
- Guards move toward danger
- Civilians avoid danger
- Commander responds
- King becomes protected

GUI:

ALARM ON
ALARM OFF
TEST ALARM

==================================================
CIVILIZATION RELATIONS
==================================================

Support:

- Neutral
- Friendly
- Allied
- Hostile

Civilizations with hostile relations can fight.

Do not automatically make every civilization hostile.

==================================================
MASS NPC SPAWNING
==================================================

Support large populations.

GUI buttons:

10 NPCs
50 NPCs
100 NPCs
250 NPCs
500 NPCs
1000 NPCs

Allow role percentages.

Example:

60% Civilian
15% Guard
10% Warrior
5% Archer
5% Captain
4% Commander
1% King

Allow custom percentages.

==================================================
PERFORMANCE
==================================================

This is extremely important.

The plugin must be optimized for large civilizations.

Target:

Up to 1000 NPCs.

DO NOT:

- Run expensive AI every tick for every NPC
- Run pathfinding for 1000 NPCs every tick
- Constantly scan every entity against every other entity
- Create unnecessary Bukkit tasks
- Perform unsafe Bukkit API calls asynchronously

Use:

- Scheduled AI updates
- Cached paths
- Cached targets
- Distance-based activation
- Nearby-player detection
- Nearby-NPC detection
- Staggered AI updates
- Limited combat calculations
- Efficient collections
- Chunk/distance activation
- Entity processing limits

NPCs far away from players should use reduced AI processing.

==================================================
NPC ACTIVATION
==================================================

Create an optimized activation system.

Example:

Nearby NPC:
Full behavior

Medium distance:
Reduced behavior

Far away:
Minimal processing

This allows large civilizations without destroying server TPS.

==================================================
PERSISTENCE
==================================================

Everything must save.

Save:

- NPC ID
- UUID
- Name
- Skin
- Location
- World
- Civilization
- Role
- Health
- Armor
- Weapon
- Path
- Patrol
- Guard post
- Home
- Behavior
- Settings

Save to YAML/JSON/SQLite or another reliable local storage system.

Everything must survive:

- Server restart
- Plugin reload where safe
- World restart

==================================================
NPC RESPAWN
==================================================

If an NPC dies:

Allow configurable behavior:

- Stay dead
- Respawn after X seconds
- Respawn at home
- Respawn at civilization headquarters

Configure through GUI.

==================================================
EQUIPMENT SYSTEM
==================================================

NPC equipment GUI:

Helmet
Chestplate
Leggings
Boots
Main Hand
Off Hand

Support:

- Diamond
- Netherite
- Iron
- Custom items
- Enchanted items

Allow custom equipment presets.

==================================================
WEAPON SYSTEM
==================================================

NPCs should properly hold weapons.

Examples:

- Sword
- Axe
- Bow
- Crossbow
- Custom weapons

Weapons must visually appear in the NPC's hand.

==================================================
ANIMATIONS
==================================================

Make NPCs visually player-like.

Support:

- Walking animation
- Arm movement
- Attack animation
- Head movement
- Looking around
- Damage animation
- Death behavior
- Equipment visibility

==================================================
CINEMATIC CONTROLS
==================================================

Add optional cinematic controls.

GUI:

- Freeze NPC
- Move NPC
- Teleport NPC
- Force look direction
- Force walk
- Force attack
- Force patrol
- Reset behavior

Useful for Minecraft YouTube videos.

==================================================
ADMIN COMMANDS
==================================================

Keep commands minimal.

Required:

/civ

/civ reload

/civ version

/civ help

Normal management should be done through GUI.

==================================================
PERMISSIONS
==================================================

Add permissions:

civilizationnpc.admin
civilizationnpc.gui
civilizationnpc.npc
civilizationnpc.civilization
civilizationnpc.reload

==================================================
CONFIGURATION
==================================================

Create config.yml.

Allow configuration of:

- NPC limits
- AI update rate
- Activation distance
- Combat distance
- Path speed
- Patrol settings
- Respawn settings
- GUI settings
- Debug mode
- Storage system

Example:

npc:
  max-active: 1000

performance:
  ai-update-interval: 5
  activation-distance: 64

==================================================
ERROR HANDLING
==================================================

The plugin must fail safely.

Do not crash the entire server.

Provide clear logs:

[CivilizationNPC]

Examples:

[CivilizationNPC] Successfully loaded.
[CivilizationNPC] Loaded 250 NPCs.
[CivilizationNPC] Created fake player NPC: Guard_Zayn

If something fails:

[CivilizationNPC] ERROR: Failed to create fake player NPC.

Explain the actual reason.

==================================================
PLUGIN.YML
==================================================

plugin.yml must NOT contain:

depend: [Citizens]

Do not declare Citizens.

Do not declare any unnecessary external Minecraft plugin dependency.

==================================================
FINAL SECURITY CHECK
==================================================

Before building the JAR, search the entire project for:

Citizens
CitizensAPI
citizensnpcs
NPCRegistry

Result must be:

ZERO

Then search for:

ArmorStand

ArmorStand must NOT be used for NPC rendering or NPC implementation.

If ArmorStand is used anywhere for a completely unrelated decorative feature, clearly separate it from NPC functionality.

==================================================
BUILD AND TEST
==================================================

Build a final:

CivilizationNPC.jar

Target:

Paper 1.21.11
Java 21

Test on a clean Paper 1.21.11 server.

Server should have NO Citizens installed.

Run:

/plugins

Expected:

CivilizationNPC = GREEN

Then run:

/civ

Expected:

Main GUI opens.

Create one NPC.

Expected:

A PLAYER-LIKE FAKE NPC appears.

It must have:

- Player skin
- Player model
- Custom name
- Armor
- Weapon
- Movement
- Looking
- Animations

It must NOT be an ArmorStand.

==================================================
FINAL ACCEPTANCE TEST
==================================================

Before giving me the final JAR, verify all of these:

[ ] Paper 1.21.11
[ ] Java 21
[ ] Citizens NOT required
[ ] Citizens NOT referenced
[ ] ArmorStand NOT used as NPC
[ ] Real player-like fake NPC
[ ] Custom skin
[ ] Custom name
[ ] Armor
[ ] Weapons
[ ] Movement
[ ] Looking
[ ] Animations
[ ] Combat
[ ] Civilizations
[ ] Roles
[ ] Paths
[ ] Patrols
[ ] Guard posts
[ ] Territory
[ ] Army
[ ] Alarm system
[ ] GUI management
[ ] Skin manager
[ ] Equipment manager
[ ] Mass spawning
[ ] Up to 1000 NPC support
[ ] Performance optimization
[ ] Persistence
[ ] NPC respawn
[ ] Minimal commands
[ ] Clean Paper server test

==================================================
MOST IMPORTANT INSTRUCTION
==================================================

DO NOT TAKE SHORTCUTS.

I specifically want a STANDALONE PLAYER-LIKE FAKE NPC SYSTEM.

Do NOT solve the problem by installing Citizens.

Do NOT solve it with ArmorStands.

Do NOT solve it with mobs.

Do NOT remove Citizens from plugin.yml while keeping Citizens API code.

Actually replace the entire Citizens NPC implementation with a compatible standalone Paper 1.21.11 fake-player implementation.

The final plugin must work on a clean Paper 1.21.11 server with NO Citizens installed.

Build the complete plugin and provide the final working JAR.
Kodari AI
KodariSep 25 at 3:09 pm 1
CivilizationNPC
A standalone Paper 1.21.11 plugin creating player-like fake NPCs for civilization simulation. Uses server-side fake player entities with real player models, skins, animations, and combat. Features GUI-based management for civilizations, NPC roles, paths, patrols, guard posts, territory, armies, and alarm systems. Optimized for up to 1000 NPCs with distance-based activation and staggered AI updates. Full persistence via YAML storage, no external dependencies.
  • Set up the Java 21/Paper project and plugin metadata.

  • Implement real server-side fake-player creation with a clear runtime error if the target server internals differ.

  • Add persisted NPC records, limited nearby-player-aware idle movement, and GUI workflows for create/list/edit/delete/skin.

  • Keep unimplemented civilization systems explicit rather than substituting another entity type or pretending they are finished.

Created the Java 21/Paper project with persisted NPC records, GUI workflows for creating and managing NPCs, and a reflective ServerPlayer implementation that reports creation errors instead of substituting another entity type.

This is not yet the complete plugin described in the specification: the civilization, combat, pathing, patrol, army, territory, and other management systems are not implemented. The fake-player implementation has not been built or tested on a live Paper 1.21.11 server, so I can’t confirm it works there or provide a verified JAR.

Uzii Verse
πŸ“Ž 1 file 16,643 chars
πŸ“„
pasted-code-1790349986359.txt
txt 971 lines
β–Ά
FIX AND COMPLETE THE CURRENT CivilizationNPC PLUGIN.

IMPORTANT:
DO NOT JUST CREATE GUI MENUS.
EVERY GUI BUTTON MUST HAVE A REAL WORKING BACKEND ACTION.

CURRENT PROBLEM:
When I try to create an NPC, I mostly get BOOK/GUI/chat-style interfaces,
but no NPC actually appears in the Minecraft world.

Sometimes the chat says that something happened, but there is NO visible NPC.

THIS IS NOT ACCEPTABLE.

I NEED A FULLY FUNCTIONAL PLUGIN, NOT A GUI MOCKUP OR PROTOTYPE.

TARGET:
Paper 1.21.11
Java 21

==================================================
CRITICAL RULE #1 β€” GUI MUST ACTUALLY WORK
==================================================

Every GUI button must perform the action shown by its name.

DO NOT create buttons that only:

- display text
- open a book
- send a chat message
- print "created"
- pretend an NPC was created
- change a temporary variable
- do nothing

Every button must call real backend logic.

Example:

CREATE NPC button
β†’ actually creates the fake player
β†’ actually registers it
β†’ actually spawns it
β†’ actually sends the required packets
β†’ actually makes it visible to nearby players
β†’ actually saves it
β†’ GUI updates with the new NPC

Do not report success unless the operation actually succeeded.

==================================================
CRITICAL RULE #2 β€” NPC MUST APPEAR IN THE WORLD
==================================================

When I click:

CREATE NPC

the NPC MUST immediately appear at the selected location.

I must be able to see it in Minecraft.

The NPC must NOT exist only in:

- memory
- database
- config
- GUI
- chat
- console

It must actually exist/appear in the Minecraft world.

==================================================
CRITICAL RULE #3 β€” REAL PLAYER-LIKE NPC
==================================================

The NPC must be a real player-like fake player.

DO NOT use:

- Citizens
- CitizensAPI
- ArmorStand
- Zombie
- Skeleton
- Villager
- Mob disguise
- ArmorStand fallback

There must be ZERO Citizens dependency.

There must be ZERO Citizens references.

There must be ZERO ArmorStand NPC implementation.

==================================================
FAKE PLAYER CREATION MUST BE COMPLETE
==================================================

Do not stop after creating a GameProfile.

Do not stop after creating a ServerPlayer object.

Do not stop after registering an entity internally.

Complete the entire client-visible spawn pipeline.

The NPC must be visible to players.

Verify the complete process:

1. Create GameProfile
2. Apply skin/profile properties
3. Create fake ServerPlayer/player entity
4. Assign correct server/world
5. Assign location
6. Register/track entity correctly
7. Send player-info/add-player information
8. Send entity spawn/add entity information
9. Make NPC visible to nearby clients
10. Apply custom name
11. Apply equipment
12. Apply rotation
13. Apply skin
14. Start movement/AI system
15. Save NPC data

Do not claim success until the client can actually see the NPC.

==================================================
CRITICAL RULE #4 β€” TEST WITH A SIMPLE NPC FIRST
==================================================

Before implementing advanced civilization features,
make the most basic NPC work.

When I click:

CREATE NPC

with:

Name:
Guard

Skin:
Any valid test skin

Location:
Player's current location

the NPC MUST appear.

Only after this works should the plugin enable:

- Path
- Patrol
- Guard post
- Civilization
- Combat
- Schedules
- Advanced AI

Do not build advanced GUI features on top of a broken NPC spawning system.

==================================================
CREATE NPC WORKFLOW
==================================================

The GUI must work like this:

/civ

β†’ NPC MANAGER

β†’ CREATE NPC

Then show a proper multi-step GUI.

STEP 1:
NPC NAME

Click:

SET NAME

Then open a proper chat input system.

Player types:

Guard Zayn

The GUI updates:

Name: Guard Zayn

STEP 2:
SKIN

Click:

SET SKIN

Ask for Minecraft username:

Dream

or another valid Minecraft username.

Retrieve/use that player's Minecraft skin.

GUI updates:

Skin: Dream

Also provide:

- Saved Skins
- Add Skin
- Remove Skin
- Select Skin
- Apply Skin

DO NOT force the user to manually enter texture/signature values
for normal skin usage.

==================================================
STEP 3 β€” ROLE
==================================================

GUI:

SELECT ROLE

Options:

Civilian
Guard
Archer
Warrior
Captain
Commander
King

Clicking a role must actually save the role.

==================================================
STEP 4 β€” EQUIPMENT
==================================================

Do NOT put equipment selection into a useless book.

Create a proper inventory GUI.

Show:

Helmet
Chestplate
Leggings
Boots
Main Hand
Off Hand

Allow the player to put actual Minecraft items into these slots.

Example:

Helmet β†’ Netherite Helmet
Chestplate β†’ Netherite Chestplate
Leggings β†’ Netherite Leggings
Boots β†’ Netherite Boots
Main Hand β†’ Diamond Sword
Off Hand β†’ Shield

Then:

SAVE EQUIPMENT

The selected equipment must actually be applied to the NPC.

==================================================
STEP 5 β€” LOCATION
==================================================

Provide:

USE MY CURRENT LOCATION

When clicked:

Save player's exact current world + X + Y + Z + yaw + pitch.

Show:

Location:
World
X
Y
Z

Then:

SPAWN NPC

must spawn the NPC at that exact location.

==================================================
STEP 6 β€” PATH
==================================================

Path must be a REAL working system.

Do not only create a GUI showing path names.

Create:

PATH MANAGER

Buttons:

CREATE PATH
EDIT PATH
DELETE PATH
VIEW PATH
ASSIGN PATH

==================================================
CREATE PATH
==================================================

When the player clicks:

CREATE PATH

enter path editing mode.

Player physically walks around the Minecraft world.

GUI/action controls:

ADD POINT
REMOVE LAST POINT
FINISH PATH
CANCEL

Example:

Player walks to Castle Gate.

Click:

ADD POINT

Actual coordinate is saved.

Then walks to North Wall.

Click:

ADD POINT

Actual coordinate is saved.

Then walks to Tower.

Click:

ADD POINT

Actual coordinate is saved.

When clicking:

FINISH PATH

the path is saved permanently.

==================================================
PATH VISUALIZATION
==================================================

While editing a path:

Show particle markers at every point.

Show:

Point 1
Point 2
Point 3

Show particles/lines connecting points.

This is only visualization.

The actual path data must be saved.

==================================================
NPC PATH ASSIGNMENT
==================================================

When editing an NPC:

PATH

opens a proper list of saved paths.

Example:

Castle Patrol
Village Road
Market Route
Farm Route

Click:

Castle Patrol

The NPC must actually follow that path.

Do not merely save the path name.

==================================================
PATH MOVEMENT
==================================================

The fake player must actually walk between the coordinates.

It must:

- Rotate toward destination
- Move toward destination
- Use walking animation
- Stop at destination
- Wait configured duration
- Move to next point

Settings:

Speed:
Slow
Normal
Fast
Custom

Pause:
0–60 seconds

Loop:
ON/OFF

Reverse:
ON/OFF

Random:
ON/OFF

==================================================
AREA PATROL
==================================================

Add a REAL working:

AREA PATROL

system.

GUI:

SET CENTER TO CURRENT LOCATION

RADIUS:

5
10
20
30
50
100

or custom radius.

The NPC must actually patrol within this area.

It must not leave the configured radius.

If it gets outside:

Return toward the patrol area.

==================================================
RANDOM AREA MOVEMENT
==================================================

For civilians:

RANDOM MOVEMENT

Set:

Center
Radius
Minimum distance
Maximum distance
Minimum pause
Maximum pause

The NPC actually chooses valid positions inside the area.

It then walks there.

It does NOT teleport from point to point.

==================================================
GUARD POST
==================================================

Create Guard Post GUI.

Create:

Guard Post Name
Location
Radius
Alert Radius
Assigned Guards
Assigned Patrol

When a guard is assigned:

It actually uses the guard post.

Normal:
Patrol

Enemy:
Defend

After combat:
Return to guard post/path

==================================================
CIVILIZATION
==================================================

Create a real civilization database/system.

GUI:

CREATE CIVILIZATION

Fields:

Name
Color
King
Territory
Headquarters

NPCs can be assigned to civilizations.

The GUI must show actual stored NPC members.

==================================================
COMBAT
==================================================

Combat must be real.

NPCs must actually:

- Detect enemies
- Target enemies
- Move toward them
- Attack
- Deal damage
- Take damage
- Die
- Respawn if configured

Do not create a fake combat GUI that does not affect entities.

==================================================
ALARM
==================================================

Alarm must actually change NPC behavior.

When an enemy enters civilization territory:

Guards:
Stop patrol

Then:
Move toward enemy

After threat is gone:
Return to previous task

==================================================
NPC EDIT GUI
==================================================

Selecting an NPC opens:

NPC EDITOR

Display:

Name
Skin
Role
Civilization
Location
Equipment
Weapon
Path
Patrol
Area
Guard Post
Home
Behavior
Schedule
Combat

Every button must actually modify the NPC.

==================================================
SAVE / LOAD
==================================================

When NPC is created:

SAVE IT.

When server restarts:

LOAD IT.

The NPC must automatically appear again.

Save:

NPC ID
Name
Skin
Location
World
Role
Civilization
Equipment
Weapon
Path
Patrol
Guard Post
Home
Area
Behavior
Schedule
Settings

==================================================
IMPORTANT β€” SUCCESS MESSAGES
==================================================

NEVER say:

"NPC created successfully"

unless the NPC was actually created AND is visible to the player.

If creation fails:

Show:

NPC CREATION FAILED

and explain the exact reason.

Example:

NPC CREATION FAILED
Reason:
Fake player entity could not be spawned on this server.

Also log the full technical exception in console.

Do not hide exceptions.

==================================================
NO BOOK-ONLY SYSTEM
==================================================

Books may NOT be the primary management interface.

I specifically want proper Minecraft INVENTORY GUIs.

Use:

CHEST GUI
HOPPER GUI
PLAYER INVENTORY GUI

where appropriate.

Each GUI must contain actual clickable buttons.

Example:

NPC MANAGER
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Create NPC β”‚ NPC List       β”‚
β”‚ Skins      β”‚ Equipment      β”‚
β”‚ Paths      β”‚ Patrols        β”‚
β”‚ Locations β”‚ Guard Posts     β”‚
β”‚ Civilizations              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

==================================================
GUI BUTTON FUNCTIONALITY TEST
==================================================

Every button must be tested.

For every button verify:

1. Click event is detected
2. Correct backend method executes
3. Data changes
4. World/entity changes if applicable
5. GUI refreshes
6. Data saves

Do not leave placeholder buttons.

Do not leave TODO actions.

Do not leave dummy messages.

Do not leave "coming soon".

==================================================
MASS NPC SPAWNING
==================================================

Support:

10
50
100
250
500
1000

BUT:

First verify that one NPC works.

Then 10.

Then 50.

Then larger populations.

Do not allow mass spawning to hide a broken basic spawn system.

==================================================
PERFORMANCE
==================================================

Optimize for up to 1000 NPCs.

Do not run expensive AI every tick.

Use:

- Scheduled AI
- Cached paths
- Staggered processing
- Distance-based activation
- Limited combat calculations
- Efficient collections
- Safe Bukkit/Paper scheduling

==================================================
DEBUG MODE
==================================================

Add:

debug: true/false

When true, log:

NPC creation start
GameProfile created
Fake player created
World assigned
Location assigned
Entity registered
Player info sent
Spawn packet sent
Skin applied
Name applied
Equipment applied
NPC visible

When false, keep logs clean.

==================================================
CURRENT ERROR FIX
==================================================

Fix:

"No compatible setCustomName method was found."

Do not use generic reflection guessing.

Use the correct Paper 1.21.11 implementation for the fake player's
custom name.

Also verify that the name is actually visible to the client.

==================================================
FINAL TEST SCENARIO
==================================================

Use a clean Paper 1.21.11 server.

NO Citizens.

Run:

/plugins

CivilizationNPC = GREEN

Then:

/civ

Open:

NPC MANAGER

β†’ CREATE NPC

Name:
Guard Zayn

Skin:
A valid Minecraft username

Role:
Guard

Location:
CURRENT LOCATION

Equipment:
Netherite Guard

Weapon:
Diamond Sword

Path:
None initially

Click:

CREATE NPC

EXPECTED RESULT:

A visible player-like NPC appears immediately at my location.

It must have:

- Player skin
- Player body
- Guard Zayn name
- Armor
- Diamond Sword

NOT:

- Book only
- Chat only
- Invisible entity
- ArmorStand
- Zombie
- Villager
- Citizens NPC

Then create a path.

Assign the path.

The NPC must physically walk the path.

Then create an Area Patrol.

The NPC must patrol the selected area.

Then restart the server.

The NPC must load again.

==================================================
FINAL ACCEPTANCE CHECKLIST
==================================================

[ ] Plugin loads GREEN
[ ] No Citizens
[ ] No ArmorStand NPC
[ ] Real player-like fake NPC
[ ] NPC actually visible
[ ] NPC actually spawns
[ ] Custom name works
[ ] Skin by Minecraft username works
[ ] Skin appears correctly
[ ] Proper inventory GUI
[ ] No book-only management
[ ] Equipment GUI works
[ ] Weapon GUI works
[ ] Role GUI works
[ ] Location GUI works
[ ] Path GUI works
[ ] Add Point works
[ ] Path visualization works
[ ] NPC follows path
[ ] NPC physically walks
[ ] Area Patrol works
[ ] Random movement works
[ ] Guard Post works
[ ] Civilization works
[ ] Combat works
[ ] Alarm works
[ ] NPC saves
[ ] NPC loads after restart
[ ] GUI refreshes after changes
[ ] Success messages only appear after actual success
[ ] Errors show actual reason
[ ] No placeholder functionality

==================================================
MOST IMPORTANT
==================================================

DO NOT GIVE ME A GUI MOCKUP.

DO NOT GIVE ME A BOOK SYSTEM THAT ONLY LOOKS LIKE A GUI.

DO NOT GIVE ME CHAT MESSAGES INSTEAD OF ACTUAL ACTIONS.

DO NOT SAY "NPC CREATED" IF NO NPC IS VISIBLE.

I NEED EVERY BUTTON CONNECTED TO REAL FUNCTIONAL BACKEND CODE.

FIRST MAKE ONE REAL PLAYER-LIKE FAKE NPC SPAWN AND BECOME VISIBLE.

THEN MAKE NAME, SKIN, EQUIPMENT, PATH, PATROL, AREA, COMBAT,
CIVILIZATION AND ALL OTHER FEATURES WORK ON THAT NPC.

ONLY AFTER ALL OF THAT IS WORKING, IMPLEMENT MASS NPC SUPPORT.

FINAL RESULT MUST BE A FULLY FUNCTIONAL CivilizationNPC PLUGIN
FOR PAPER 1.21.11.
Kodari AI
KodariSep 25 at 6:04 pm 32
  1. Make the basic fake-player NPC spawn visibly and fix the custom-name path.

  2. Connect creation GUI inputs and persist/reload the NPC.

  3. Implement the remaining NPC systems (equipment, paths, patrol, civilization, and combat) against the working entity.

Starting with the spawn pipeline.

  1. Fake-player spawning now uses the Bukkit custom-name component API, registers through the player-specific native world path, and fails creation instead of reporting success when registration fails.

  2. Next, wire creation GUI state to persisted NPC fields and actual spawn data.

  3. Then implement the remaining NPC systems on that verified foundation.

  1. The NPC setup inventory now collects a name, role, and exact player location; spawn failures roll back and are reported, while successful NPC data persists for restart.

  2. Next: add a working equipment editor whose saved items are applied to the fake player.

  1. Equipment now has editable armor/hand slots, saves all six item stacks, and applies them on spawn and when saved.

  2. Next: implement persistent path editing and real walking movement.

  1. Named paths now persist, support point capture/edit/delete/view/assignment and particles, and advance assigned NPCs in bounded walking steps with speed, pause, loop, reverse, and random settings.

  2. Next: replace manual skin textures with asynchronous Minecraft-username skin lookup for creation and editing.

  1. Skin input now accepts Minecraft usernames, resolves signed textures asynchronously, and applies them during creation or NPC skin updates.

  2. Next: add configurable area patrol and random walking within assigned bounds.6. Area patrol now persists its center, radius, movement mode, distance limits, and pauses; NPCs step toward valid targets inside the configured boundary instead of teleporting.

  3. Next: add a persistent saved-skins library with select/apply/remove actions.

  1. Saved Skins now supports username lookup, persistence, selection during creation, applying to existing NPCs, and removal.

  2. Next: make Guard Posts persist locations/radii and drive assigned guard behavior.

  1. Guard Posts now persist post settings, assigned guards, and an optional patrol path; guards without a post path patrol the post’s bounded area.

  2. Next: add the persistent civilization registry, member/king assignment, territory, and headquarters controls.

  1. Civilizations now persist members, king, color, territory center/radius, and headquarters, with working assignment and management GUIs.

  2. Next: connect guard alerts and combat to actual NPC/hostile entities.

  1. Combat now targets hostile mobs, guards scan assigned-post/civilization radii, fake NPC damage is tracked, and respawn timing is persisted/configurable.

  2. Next: include the six-slot equipment editor in the pre-spawn creation workflow.

Implemented the core backend flows: fake-player creation now applies the Paper custom-name component and uses player-specific world registration; creation failures propagate instead of producing false success messages. The creation inventory now captures name, role, username-based skin, exact location, and equipment before spawning. NPCs, skins, equipment, paths, area settings, guard posts, and civilizations are persisted; path and area movement advance in steps, and basic hostile-mob combat includes NPC damage, death, and configured respawn.

I also replaced the generic placeholder destinations with working menus for the listed modules. A source search found no Citizens or ArmorStand references.

This is not yet acceptance-tested on a clean Paper 1.21.11 server. I can’t verify packet delivery, client visibility, or movement in-game here, so I won’t claim the fake player is confirmed visible. Combat targets hostile mobs rather than enemy players or rival civilizations; mass-spawn controls and schedules are also not implemented. A live server test is still needed before treating the full request as complete.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
settings.gradle
Code
32 4,388
src/main/java/com/kodari/civilizationnpc/CivilizationNPCPlugin.java
package com.kodari.civilizationnpc;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import com.cryptomorin.xseries.particles.XParticle;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.logging.Level;
import java.util.function.Consumer;

public final class CivilizationNPCPlugin extends JavaPlugin implements Listener {
    private final Map<UUID, UUID> pendingSkinInputs = new HashMap<>();
    private final Map<UUID, Boolean> pendingCreateInputs = new HashMap<>();
    private final Map<UUID, Boolean> pendingCreationSkinInputs = new HashMap<>();
    private final Map<UUID, Boolean> pendingLibrarySkinInputs = new HashMap<>();
    private final Map<UUID, Boolean> pendingPathNameInputs = new HashMap<>();
    private final Map<UUID, Boolean> pendingGuardPostNameInputs = new HashMap<>();
    private final Map<UUID, Boolean> pendingCivilizationNameInputs = new HashMap<>();
    private final Map<UUID, UUID> pendingAreaRadiusInputs = new HashMap<>();
    private final Map<UUID, NpcCreationSession> creationSessions = new HashMap<>();
    private final Map<UUID, NpcPath> pathEditingSessions = new HashMap<>();
    private NpcManager npcManager;
    private NpcPathManager pathManager;
    private GuardPostManager guardPostManager;
    private CivilizationManager civilizationManager;
    private final SkinResolver skinResolver = new SkinResolver();
    private SavedSkinLibrary skinLibrary;
    private CivilizationMenu menu;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        pathManager = new NpcPathManager(this);
        guardPostManager = new GuardPostManager(this);
        civilizationManager = new CivilizationManager(this);
        npcManager = new NpcManager(this, pathManager, guardPostManager, civilizationManager);
        skinLibrary = new SavedSkinLibrary(this);
        menu = new CivilizationMenu(this);
        getServer().getPluginManager().registerEvents(new MenuListener(this), this);
        getServer().getPluginManager().registerEvents(new ChatInputListener(this), this);
        getServer().getPluginManager().registerEvents(new CombatListener(npcManager), this);
        getCommand("civ").setExecutor(this::executeCommand);
        try {
            pathManager.load();
            guardPostManager.load();
            civilizationManager.load();
            skinLibrary.load();
            npcManager.load();
            npcManager.start();
            getLogger().info("Successfully loaded.");
        } catch (RuntimeException exception) {
            getLogger().log(Level.SEVERE, "Plugin initialization failed; no alternative entity type will be spawned.", exception);
        }
    }

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

    public NpcManager getNpcManager() {
        return npcManager;
    }

    public void openNpcDetails(Player player, UUID npcId) {
        menu.openNpcDetails(player, npcId);
    }

    public void openNpcCreation(Player player) {
        menu.openNpcCreation(player);
    }

    public NpcPathManager getPathManager() {
        return pathManager;
    }

    public SavedSkinLibrary getSkinLibrary() {
        return skinLibrary;
    }

    public GuardPostManager getGuardPostManager() {
        return guardPostManager;
    }

    public CivilizationManager getCivilizationManager() {
        return civilizationManager;
    }

    public void beginCivilizationCreation(Player player) {
        if (!player.hasPermission("civilizationnpc.civilization")) {
            player.sendMessage(ChatColor.RED + "You do not have permission to manage civilizations.");
            return;
        }
        pendingCivilizationNameInputs.put(player.getUniqueId(), true);
        player.closeInventory();
        player.sendMessage(ChatColor.YELLOW + "Type a name for the civilization, or type cancel.");
    }

    public void setCivilizationHeadquarters(Player player, UUID civilizationId) {
        try {
            civilizationManager.setHeadquarters(civilizationId, player.getLocation().clone());
            player.sendMessage(ChatColor.GREEN + "Headquarters location saved.");
        } catch (RuntimeException exception) {
            player.sendMessage(ChatColor.RED + "Could not set headquarters: " + exception.getMessage());
        }
        menu.openCivilizationDetails(player, civilizationId);
    }

    public void setCivilizationTerritory(Player player, UUID civilizationId) {
        try {
            civilizationManager.setTerritory(civilizationId, player.getLocation().clone());
            player.sendMessage(ChatColor.GREEN + "Territory center saved.");
        } catch (RuntimeException exception) {
            player.sendMessage(ChatColor.RED + "Could not set territory: " + exception.getMessage());
        }
        menu.openCivilizationDetails(player, civilizationId);
    }

    public void updateCivilizationSettings(Player player, UUID civilizationId, String color, double radius) {
        try {
            civilizationManager.updateSettings(civilizationId, color, radius);
            player.sendMessage(ChatColor.GREEN + "Civilization color and territory radius saved.");
        } catch (RuntimeException exception) {
            player.sendMessage(ChatColor.RED + "Could not update civilization: " + exception.getMessage());
        }
        menu.openCivilizationDetails(player, civilizationId);
    }

    public void assignNpcCivilization(Player player, UUID npcId, UUID civilizationId) {
        NpcRecord record = npcManager.get(npcId);
        if (record == null) {
            player.sendMessage(ChatColor.RED + "That NPC no longer exists.");
            menu.openNpcList(player, 0);
            return;
        }
        String newName = "";
        if (civilizationId != null) {
            Civilization civilization = civilizationManager.get(civilizationId);
            if (civilization == null) {
                player.sendMessage(ChatColor.RED + "That civilization no longer exists.");
                menu.openNpcDetails(player, npcId);
                return;
            }
            newName = civilization.getName();
        }
        for (Civilization civilization : civilizationManager.getCivilizations()) {
            if (npcId.equals(civilization.getKingId()) && !civilization.getName().equalsIgnoreCase(newName)) {
                civilizationManager.setKing(civilization.getId(), null);
            }
        }
        try {
            npcManager.setCivilization(npcId, newName);
            player.sendMessage(ChatColor.GREEN + (newName.isEmpty() ? "NPC removed from its civilization." : "NPC assigned to " + newName + "."));
        } catch (RuntimeException exception) {
            player.sendMessage(ChatColor.RED + "Could not assign civilization: " + exception.getMessage());
        }
        menu.openNpcDetails(player, npcId);
    }

    public void setCivilizationKing(Player player, UUID civilizationId, UUID npcId) {
        Civilization civilization = civilizationManager.get(civilizationId);
        NpcRecord record = npcManager.get(npcId);
        if (civilization == null || record == null) {
            player.sendMessage(ChatColor.RED + "The civilization or NPC no longer exists.");
            menu.openCivilizationDetails(player, civilizationId);
            return;
        }
        if (record.getRole() != NpcRole.KING || !record.getCivilization().equalsIgnoreCase(civilization.getName())) {
            player.sendMessage(ChatColor.RED + "Only a King-role NPC assigned to this civilization can be its king.");
            menu.openKingSelector(player, civilizationId);
            return;
        }
        try {
            civilizationManager.setKing(civilizationId, npcId);
            player.sendMessage(ChatColor.GREEN + record.getName() + " is now the civilization's king.");
        } catch (RuntimeException exception) {
            player.sendMessage(ChatColor.RED + "Could not set king: " + exception.getMessage());
        }
        menu.openCivilizationDetails(player, civilizationId);
    }

    public void deleteCivilization(Player player, UUID civilizationId) {
        Civilization civilization = civilizationManager.get(civilizationId);
        if (civilization == null) {
            menu.openCivilizations(player);
            return;
        }
        try {