Cancelling the RespawnEvent

I am searching for an option to cancel a Player’s Respawn. He stays in the Deathscreen a couple of seconds and then when he wants to Respawn. The plugin should deny it an kick him out of the Server.

The problem is that when I kick him in the RespawnListener then he still respawns though he was kicked from the Server!

I need your help Thank you:)

Forward

From what I can see in the API, PlayerRespawnEvent doesn’t extend Cancellable, which would mean it isn’t cancellable.

@Forward
What you want to do is listen to DamageEntityEvent and check DamageEntityEvent#willCauseDeath()

You can’t really cancel a respawn on the client without unknown consequences. The player respawn logic was once tested in the bucket days and it wasn’t safe at best. If you’d like, open an issue on Github and it can be discussed further if it’s still not possible to do safely or whether it’s entirely plausible to add such a thing sooner than later.