Could not find entity trackers for CraftPlayer (IllegalArgumentException)
xtomyserrax opened this issue · 7 comments
Hey, Im getting this error when a player joins and I try to getEntityTrackers but this is only happening to me on Paper and not on Spigot. Is there a problem in my code? (the other day you just saved my life). This is the error: https://pastebin.com/1aGeFnqt
For this testings I used: latest ProtocolLib version (4.5.1), latest paper version and latest spigot version.
This is line 131:
if (ProtocolLibrary.getProtocolManager().getEntityTrackers((Entity) playerhidden).contains(playersonline))
I mean player is just joining the server so yeah maybe could be that an entity id still doesnt exist? But why in spigot its working fine? Sorry if Im doing something horrible, if you know how I can fix it please let me know!
Thanks!!
Just when player joins the server. Then, that code can be executed and works perfectly (when called by a command for example)
Again, it just happens with Paper, not Spigot. (but for example the problem I reported the other day also happened only with paper but it got fixed when I added the ListenerOption)
Talked to the Paper guys, they think the tracker is not supposed to contain the player in the join event. So I'm not really sure what the right solution is, but this is expected behavior (TM)
Oh :(
Well according to them they try to mantain support for spigot plugins, idk if it can be fixed
I wanted to be sure that it wasnt a bug I made and a bug from ProtocolLib.
Thank you and thanks for contacting them! Ill have to remove this feature for paper servers but will mantain it for spigot ones then
as discussed on the paper discord;
Entities are not in the world tracker until after the join event, that should apply to spigot too, the only real behavioral difference with that event is that on CB/Spigot, if you do teleport in there, you'll be added to the world earlier, causing the tracker to be set before it really should be, causing that leak; That specifically is not an issue on paper, which is likely what has changed to cause your issue; There is no /real/ workaround here given that this is only really a side-effect from an issue created by CB
This isn't an area of plugins at all, this is internal implementation detail, and CB leaking the tracker early was causing other issues (or, more, the stuff leading to the tracker being there before it should be, etc)