PlayPro / CoreProtect

CoreProtect is a blazing fast data logging and anti-griefing tool for Minecraft servers.
Artistic License 2.0
649 stars 326 forks source link

Custom player head generate a warning "Owner is null" #643

Open Athar42 opened 3 weeks ago

Athar42 commented 3 weeks ago

Hi there,

With CoreProtect-Edge 23.1, I get this "error" each time I place or break a custom player head (same message, whatever the head is, tested with, at least, Iron Golem and Ghast heads) :

[18:56:29 WARN]: java.lang.NullPointerException: Cannot invoke "String.length()" because "owner" is null
[18:56:29 WARN]:        at CoreProtect-Edge-23.1.jar//net.coreprotect.paper.Paper_v1_20.getSkullOwner(Paper_v1_20.java:37)
[18:56:29 WARN]:        at CoreProtect-Edge-23.1.jar//net.coreprotect.database.logger.SkullPlaceLogger.log(SkullPlaceLogger.java:36)
[18:56:29 WARN]:        at CoreProtect-Edge-23.1.jar//net.coreprotect.consumer.process.BlockPlaceProcess.process(BlockPlaceProcess.java:20)
[18:56:29 WARN]:        at CoreProtect-Edge-23.1.jar//net.coreprotect.consumer.process.Process.processConsumer(Process.java:148)
[18:56:29 WARN]:        at CoreProtect-Edge-23.1.jar//net.coreprotect.consumer.Consumer.run(Consumer.java:133)
[18:56:29 WARN]:        at java.base/java.lang.Thread.run(Thread.java:1583)

image

Those heads are generated by a Vanilla Tweak datapack : More mob heads

Server : PaperMC version 1.21.1-build 85 (will update to build 89, but that will not change this behavior :D ) DataPack "More Mob Heads" version 2.14.0

Best regards,

Skullians commented 3 weeks ago

Looks like when the datapack generates player heads it’s not specifying an owner… Will have to wait for a release that fixes it

Skullians commented 3 weeks ago

It’s a fairly simple fix. I’ll take a look at making a PR.

Athar42 commented 3 weeks ago

I assume the issue is there : https://github.com/PlayPro/CoreProtect/blob/master/src/main/java/net/coreprotect/paper/Paper_v1_20.java

Funny thing is it appear that CO seems to add the owner if none are set. Somehow, it didn't work as it's empty :D (with "setSkullOwner")

Edit : By looking at both : https://github.com/PlayPro/CoreProtect/blob/master/src/main/java/net/coreprotect/database/logger/SkullPlaceLogger.java and https://github.com/PlayPro/CoreProtect/blob/master/src/main/java/net/coreprotect/database/logger/SkullBreakLogger.java

They only refer to the "getSkullOwner" function, but they check if the item as the "hasOwner" set to true : if (skull.hasOwner()) {

Somehow, it pass this check even if the "owner" is set to "null". Don't have more time to have a deeper look at it, but that has something to do with those 3 files :D

Skullians commented 3 weeks ago

Yeah, it’s probably some weird stuff that the datapack does.