Fix NPE while trying to respawn an already disconnected player#11353
Conversation
|
I feel like the "isOnline" method should already be checking this. What about changing the implementation of |
i mean isOnline docs already mention the player can have instances where is online but is disconnected and recommed check other method.. make this change require change the behaviour of that method and can cause "side" effects... and yeah exists isDisconnected but that check another place and not the method used in respawn then for this case i think is better just check the same thing... |
|
This only fix one specific NPE and not the other ones that might happens on the same var. |
You mean for the connection null? Or i missing another? |
9939d34 to
d7b17e3
Compare
d7b17e3 to
8215760
Compare
|
@Lulu13022002 Moved the diff around, would like your review, I agree that the spigot logic here is rather terrible, but I don't think such a massive diff is nice to maintain for such a scuffed impl. |
Lulu13022002
left a comment
There was a problem hiding this comment.
LGTM, i have renamed the pr now that the original pr has been rewritten completely.
I think the old check can be removed instead of the diff on change. Otherwise there's a typo too.
The npe results in the incorrect call added by our player post respawn event, which assumes the dimension transition is non-null. Copies the early return from spigot to not NPE instead of the connection check in #respawn.
8215760 to
6c255a6
Compare
Closes #11352 by adding a new check for not run the method if the connection is in disconnect state, the method depends in many other methods related to connections then can cause NPE in many places of the respawn logic call the method for things like respawn a player in the disconnection state.
Example related to the issue reported for replicate and test.