Citizens NPC head not dropping
CraftBook Version
craftbook-bukkit-5.0.0-SNAPSHOT-dist
Platform Version
paper-1.21.4-227
Confirmations
- [x] I am using the most recent Minecraft release.
- [x] I am using a version of WorldEdit compatible with my Minecraft version.
- [x] I am using a version of CraftBook compatible with my Minecraft version.
- [x] I am using the latest or recommended version of my platform software.
- [x] I am NOT using a hybrid server, e.g. a server that combines Bukkit and Forge. Examples include Arclight, Mohist, and Cardboard.
- [x] I am NOT using a fork of WorldEdit, such as FastAsyncWorldEdit (FAWE) or AsyncWorldEdit (AWE)
Bug Description
I have combat NPC of the Citizens plugin on my server. Players fight with them and when they kill them, the head should drop from the NPC, but it doesn't drop and there is an error in the console https://pastebin.com/VZq2BFTQ
Expected Behavior
The NPC head should fall out
Reproduction Steps
- Killing NPCs
- The head didn't fall out
- Error in console
Anything Else?
No response
This looks like the error is within Paper, when grabbing data about the player (name, skin, etc), because the NPC plugin has put invalid data on the player. This information is 100% necessary for HeadDrops to work, so this would either need to be fixed within the NPC plugin or Paper.
Either the NPC plugin needs to stop giving invalid data that causes Paper to error, or Paper needs to be more lenient about the data it allows. My bet is Paper would pass it off to the NPC plugin to not provide invalid data.
There's nothing CraftBook can do here, as it inherently needs that data to function. This issue is entirely outside of CraftBook.
Could this be because NPC nicknames use color codes?
Possibly yes, the invalid part of the data is the player's name
I have 13 NPCs with the same nicknames and the difference is in the colors of the nicknames. Maybe it is possible to make support for colored nicknames of heads in Craftbook?
As I said, this error isn't within CraftBook, it's within Paper. The function being called is the one that gives the plugin access to the player texture data, which is required to put a player texture on the head. It's Paper that would need to support it, or the NPC plugin would need to strip the colour when providing that data to Paper's API.
As-is, getting the player texture of a player with a nickname with invalid characters causes an error within Paper. All CraftBook could theoretically do is silence the error. Nothing other than Paper or the NPC plugin fixing the underlying issue would allow CraftBook to get the required texture data.