PlayerRespawnEvent is called even if UserTeleportEvent has been canceled
BoomEaro opened this issue · 1 comments
Information
Full output of /ess version
:
[21:59:20] [Server thread/INFO]: Server версия: 1.12.2-R0.1-SNAPSHOT git-Paper-1615 (MC: 1.12.2)
[21:59:20] [Server thread/INFO]: EssentialsX версия: 2.17.2.144
[21:59:20] [Server thread/INFO]: LuckPerms версия: 5.0.118
[21:59:20] [Server thread/INFO]: Vault версия: 1.5.6-b49
[21:59:20] [Server thread/INFO]: Citizens версия: 2.0.26-SNAPSHOT (build 1861)
[21:59:20] [Server thread/INFO]: EssentialsXChat версия: 2.17.2.144
[21:59:20] [Server thread/INFO]: EssentialsXSpawn версия: 2.17.2.144
Server log: not needed
EssentialsX config: not needed
Details
Description
It looks like PlayerRespawnEvent is called even if UserTeleportEvent is canceled.
Steps to reproduce
- Write a simple plugin that listens to the PlayerRespawnEvent and UserTeleportEvent events.
- Always cancel the UserTeleportEvent event.
- As an example of teleportation, use the /home command.
- Make sure that you do not have a single house created by the /sethome command.
- Try using /home with no arguments. (logically, you will have to teleport to spawn, but the UserTeleportEvent event is canceled, however, PlayerRespawnEvent is still called, although the player was not even moved to the spawn point)
Expected behavior
In my opinion, PlayerRespawnEvent should not be called if the player was not really teleported.
Screenshots
none
The problem is that the PlayerRespawnEvent event is called before teleportation processing is called:
While you are correct that PlayerRespawnEvent probably shouldn't be called, the reason it's called by Essentials is to hook into other plugins (include Essentials itself) which modify the spawn location. This is an old behavior that has been in Essentials for a long time which is why changing it would be breaking. Additionally, it would require a refactor of the Teleport code I just refactored 😅
For those reasons, closed for wonfix.