TechnicJelle / BlueMapSignExtractor

Minecraft Paper plugin and BlueMap addon that adds markers for all signs
7 stars 4 forks source link

Translated signs cause exception #64

Closed Michael-1001 closed 1 week ago

Michael-1001 commented 1 week ago

I think the log below shows I'm on Purpur/Paper, etc. Suffice to say, this occurs once at startup and I don't really see it again.

I do like the added feature of hiding blank signs though so I don't really want to downgrade haha.

[14:57:23 WARN]: [BlueMapSignExtractor] Plugin BlueMapSignExtractor v1.4 generated an exception while executing task 48                                                                                                               
java.lang.NullPointerException: Cannot invoke "String.isBlank()" because the return value of "com.technicjelle.bluemapsignextractor.versions.MC_1_20_4.MC_1_20_4_Sign$Side.unJSON(String)" is null
        at BlueMapSignExtractor.jar/com.technicjelle.bluemapsignextractor.versions.MC_1_20_4.MC_1_20_4_Sign$Side.isWrittenOn(MC_1_20_4_Sign.java:40) ~[BlueMapSignExtractor.jar:?]
        at BlueMapSignExtractor.jar/com.technicjelle.bluemapsignextractor.versions.MC_1_20_4.MC_1_20_4_Sign.getLabel(MC_1_20_4_Sign.java:87) ~[BlueMapSignExtractor.jar:?]                                                            
        at BlueMapSignExtractor.jar/com.technicjelle.bluemapsignextractor.common.Core.fillMarkerSetFromRegionFile(Core.java:62) ~[BlueMapSignExtractor.jar:?]
        at BlueMapSignExtractor.jar/com.technicjelle.bluemapsignextractor.common.Core.lambda$loadMarkerSetFromWorld$2(Core.java:42) ~[BlueMapSignExtractor.jar:?]                   
        at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[?:?]                                                                                                                                   
        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[?:?]
        at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133) ~[?:?]                                                                                                                                                    
        at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939) ~[?:?]                                                                                                                       
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]                                                                                                                              
        at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[?:?]                                                                                                                             
        at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[?:?]
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]                                                                                                                                     
        at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[?:?]                                                                                                                                    
        at BlueMapSignExtractor.jar/com.technicjelle.bluemapsignextractor.common.Core.loadMarkerSetFromWorld(Core.java:42) ~[BlueMapSignExtractor.jar:?]
        at BlueMapSignExtractor.jar/com.technicjelle.bluemapsignextractor.common.Core.addMarkersToBlueMapWorld(Core.java:24) ~[BlueMapSignExtractor.jar:?]
        at BlueMapSignExtractor.jar/com.technicjelle.bluemapsignextractor.impl.paper.BlueMapSignExtractor.loadMarkersFromWorlds(BlueMapSignExtractor.java:71) ~[BlueMapSignExtractor.jar:?]                                           
        at BlueMapSignExtractor.jar/com.technicjelle.bluemapsignextractor.impl.paper.BlueMapSignExtractor.lambda$new$0(BlueMapSignExtractor.java:54) ~[BlueMapSignExtractor.jar:?]
        at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:86) ~[purpur-1.21.1.jar:1.21.1-2329-803bf62]         
        at org.bukkit.craftbukkit.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[purpur-1.21.1.jar:1.21.1-2329-803bf62]                                                                                                       
        at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[purpur-1.21.1.jar:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]                                                                                                                           
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]                                                                                                                           
        at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
TechnicJelle commented 1 week ago

Hi, thanks for the bug report! Do you think you could send your world folder? (Or maybe the specific region file where this is happening in, if you can find it.) I'd love to have a closer look at the data in there, so I can adapt my code to handle data in that format you seem to have.

Michael-1001 commented 1 week ago

Uh might be able to send the region later tonight. I believe it's where some empty signs are.

EDIT: Sent on Discord.

TechnicJelle commented 1 week ago

I have received them over Discord, and reproduced the issue locally. After a bit of searching, I found out that these signs don't contain normal text ("normal text"), but JSON. However, support for that was added in f68ba244f36177aac08b99235af266e1d1a5b223

The cause of this issue is that the custom JSON doesn't have a text key(!). Just some other stuff. Very odd.

I will need to think about what to do about this. Maybe knowing which plugin is doing this will help me decide.

TechnicJelle commented 1 week ago

It ended up being a vanilla game mechanic that I did know of: translated text!

The NBT Data of the problematic signs in the world @Michael-1001 sent me looked like this: image

No text key. Just a translate key. According to the wiki, these are for showing different text in different languages. A really cool mechanic! The actual strings are provided by a resource-pack.

@Michael-1001 then also sent me the server resource-pack they're using, and there we found the final answer! image These signs were created by the data-pack From The Fog.

For the time being, I will make my plugin treat lines that don't have normal text as blank. I will think about how to support (and if I even want to) this. It would require parsing resources, and I am not particularly looking forward to that, to be particularly honest. Not for a plugin like this. Although, now that I am typing this... I did want to support the sign textures from the user's resource-pack... Perhaps I could combine these tasks. I will create a new issue to track this feature request.