#(bestdad1) NPE in NMSImpl.markPoseDirty during NPCLinkToPlayerEvent when NPC Kills Player

37 messages · Page 1 of 1 (latest)

brittle pendant
#

I’m encountering a NullPointerException in Citizens when a player is killed by an NPC equipped with the Sentinel trait. The error originates in net.citizensnpcs.nms.v1_21_R3.util.NMSImpl.markPoseDirty and occurs during the NPCLinkToPlayerEvent. It seems the NPC’s Minecraft entity handle becomes null, causing Citizens to fail when updating the NPC’s state post-kill.

Steps to Reproduce:

Create a Citizens NPC with the following setup:
Entity type: PLAYER
Add SentinelTrait
Configure Sentinel: sentinel.addTarget("PLAYERS"), sentinel.reach = 3.2, sentinel.fightback = true, sentinel.setHealth(20.0)

Spawn the NPC in the game world.
Allow the NPC to attack and kill a player (e.g., via melee combat).
Observe the server console for the error.

Message: java.lang.NullPointerException: Cannot invoke "net.minecraft.world.entity.Entity.getEntityData()" because "handle" is null

Location: NMSImpl.markPoseDirty(NMSImpl.java:1231)
Event: NPCLinkToPlayerEvent

Stack Trace: Starts at net.citizensnpcs.EventListen.onNPCLinkToPlayer(EventListen.java:534) and involves entity tracking updates (ChunkMap$TrackedEntity). The full trace is lengthy; I can provide it via pastebin or Discord if needed.

Expected Behavior:
The NPC should kill the player without causing a server error, and Citizens should handle the NPC’s state update (e.g., pose or visibility) gracefully.

Actual Behavior:
The server logs a NullPointerException, indicating Citizens tries to access the NPC’s entity data after its handle becomes null, likely due to the player’s death altering the game state.

stone locustBOT
#

(bestdad1) NPE in NMSImpl.markPoseDirty during NPCLinkToPlayerEvent when NPC Kills Player

stone locustBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

urban quest
#

!logs

shadow loomBOT
# urban quest !logs
Info: logs

Please post your full latest log file.

Background Info: One of the most helpful tools to identifying the source of a problem is your server logs file! Logs contain all sorts of important information like server and plugin versions, any error messages, and a lot more important information (More Info).

How To: Your log can be found in the logs folder within your server folder. The most recent log is a text file labeled latest.log. To get help using these logs, please open that file in a text editor and copy all of the text, then open https://paste.denizenscript.com/New/Log and paste the text into the box on the page. Then click "Submit" and copy the URL and paste that back into this channel.

Please do not upload the file to Discord or to other pastebin services, use the log pastebin linked above.

brittle pendant
#

!logs

shadow loomBOT
# brittle pendant !logs
Info: logs

Please post your full latest log file.

Background Info: One of the most helpful tools to identifying the source of a problem is your server logs file! Logs contain all sorts of important information like server and plugin versions, any error messages, and a lot more important information (More Info).

How To: Your log can be found in the logs folder within your server folder. The most recent log is a text file labeled latest.log. To get help using these logs, please open that file in a text editor and copy all of the text, then open https://paste.denizenscript.com/New/Log and paste the text into the box on the page. Then click "Submit" and copy the URL and paste that back into this channel.

Please do not upload the file to Discord or to other pastebin services, use the log pastebin linked above.

brittle pendant
candid crescent
shadow loomBOT
# candid crescent !logcheck https://paste.denizenscript.com/View/131176
Server Version

Paper version 1.21.4-172-main@09f1f88 (2025-02-18T00:09:14Z)

Plugin Version(s)

Citizens v2.0.37-SNAPSHOT (build 3716) -- (Current build :white_check_mark:)
Sentinel v2.9.2-SNAPSHOT (build 527) -- (Outdated build, behind by 1)

Checked For

@candid crescent

Other Noteworthy Plugin(s)

WorldGuard v7.0.13+82fdc65, ProtocolLib v5.4.0-SNAPSHOT-741

Problematic Plugin(s)

PlugManX v2.4.1 - :warning: Plugin Managers are dangerous and will cause unpredictable issues. Remove it.

Possibly Relevant Plugin(s)

TAB v5.0.7 - This plugin adds Below_Name scoreboards to NPCs.
ViaVersion v5.2.1 - Mixed client vs server versions can sometimes cause packet-related issues.
FastAsyncWorldEdit v2.12.4-SNAPSHOT-1050;0a0ea67 - This plugin has been known to break the plugin load order on many servers, due to usage of the 'loadbefore' directive in its 'plugin.yml'.

brittle pendant
#

bruh

#

clearly none of these are the issue

candid crescent
#

your log was cut off

#

I can't see NPE

brittle pendant
#

!logcheck

shadow loomBOT
candid crescent
shadow loomBOT
# candid crescent !logcheck https://paste.denizenscript.com/View/131177
Server Version

Paper version 1.21.4-172-main@09f1f88 (2025-02-18T00:09:14Z)

Plugin Version(s)

Citizens v2.0.37-SNAPSHOT (build 3716) -- (Current build :white_check_mark:)
Sentinel v2.9.2-SNAPSHOT (build 527) -- (Outdated build, behind by 1)

Checked For

@candid crescent

UUID Version

4 (:white_check_mark: Online)

Java Version

22.0.2 :warning: - Only Java versions 21 or 17 are fully supported (or 8 for legacy Minecraft)

Other Noteworthy Plugin(s)

WorldGuard v7.0.13+82fdc65, ProtocolLib v5.4.0-SNAPSHOT-741

Problematic Plugin(s)

PlugManX v2.4.1 - :warning: Plugin Managers are dangerous and will cause unpredictable issues. Remove it.

Possibly Relevant Plugin(s)

TAB v5.0.7 - This plugin adds Below_Name scoreboards to NPCs.
ViaVersion v5.2.1 - Mixed client vs server versions can sometimes cause packet-related issues.
FastAsyncWorldEdit v2.12.4-SNAPSHOT-1050;0a0ea67 - This plugin has been known to break the plugin load order on many servers, due to usage of the 'loadbefore' directive in its 'plugin.yml'.

Potentially Bad Line(s)

[06:00:03] [Server thread/ERROR]: Could not pass event NPCLinkToPlayerEvent to Citizens v2.0.37-SNAPSHOT (build 3716) :warning: Log contains error messages.

brittle pendant
#

yeah i knew all this lol is it a problem with citizens or sentinel with the latest verison of minecraft?

candid crescent
#

well... yes.... I think I need to leave this to fullwall as I've seen this type of issue before but not got fixed yet

autumn plinth
#

The logcheck pulls up general info from the log and points out potential issues

brittle pendant
#

ok if i fix it can i just post the fix too github? i really didnt want to go into your guys source code but i will if i have too. do you know a eta your dev can fix this?

candid crescent
#

no eta for citizens, fullwall, who maintained the dev of Citizens, have his own full-time job to do

brittle pendant
#

yeah yeah we all do lol just wondering

brittle pendant
#

speaking of witch i got to go to work right now will see if i can fix it later peace

candid crescent
#

nvm

#

you can fork it, try to fix it, and submit PR as your contribution back

brave sable
#

can you try in new build?

brittle pendant
#

Yeah I will when I get home working atm I didn't have much time after I posted this error to figure it out before I had to leave

brittle pendant
#

latest build solved the problem good work wan appreciate it!

broken daggerBOT
#
Thread Closing Reminder

Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.

If not yet resolved, please reply below to tell us what you still need.

(Note that if there is no reply for a few days, this thread will eventually close itself.)

#

@brittle pendant