lucko / helper

A collection of utilities and extended APIs to support the rapid and easy development of Bukkit plugins.
MIT License
456 stars 87 forks source link

Fix individual holograms #114

Closed MrMicky-FR closed 3 years ago

MrMicky-FR commented 3 years ago

This fixes individual holograms, which are currently working only on 1.8, by making multiples changes to fix issues:

To fix the client kick with Internal Exception: io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: readerIndex(4) + length(1) exceeds writerIndex(4): UnpooledHeapByteBuf(ridx: 4, widx: 4, cap: 4) on 1.9 and newer, I replaced the use of new WrappedWatchableObject(2, value) by directly modifying the current metadata while keeping the same behavior, which fix this issue. Seems like ProtocolLib is not resolving the serializer when calling the WrappedWatchableObject constructor, as you can see on these dumps. The first is with new WrappedWatchableObject(2, value) and the second is with the data of the entity metadata packet (DataWatcherRegistry$8 is a DataWatcherSerializer<String>): 903D3E23-F46D-4F60-9B8C-A9CD20D706BF 6AA16C5B-4777-4AA3-AFF0-B3879606B701

I also fixed the failing build introduced by a10e5ede8a7f0a1e50465ae82bd225bbef4bbf1f

Finally, this should closes #28 as the issue with scoreboards is already solved

About Minecraft 1.17, due to the large amount of NMS changes in 1.17, I didn't got the time to add its support for now (maybe a next pull request), but this PR fixes support on 8 Minecraft major versions so I think it's good step forward 🙂

lucko commented 3 years ago

Amazing! Thanks so much :)