Open WeaselSqueezer opened 10 years ago
ok so after much testing, debugging, and code reading, I have found the issue and I discovered that it is not an issue with your plugin. It is in fact an issue with craftbukkit... So when you use player.setHealth(0d) and the player dies, the PlayerDeathEvent is called BEFORE the players health is set to 0... so any event handler for PlayerDeathEvent caused by some plugin setting the players health, if the handler teleports the player, the teleport will succeed since the players health has not been set to 0 yet and craftbukkit thinks the player is alive... Here is where the PlayerDeathEvent is called: https://github.com/Bukkit/CraftBukkit/blob/master/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java#L85 Notice it is before the health is actually set. So in player.teleport() (shown below) https://github.com/Bukkit/CraftBukkit/blob/master/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java#L453 the player is teleported. thus when the player actually clicks the respawn button, they are teleported to their spawn because your plugin already handled the teleportation from the PlayerDeathEvent....
sigh time to do more digging to find a fix on my end.... ugh
I made 'death regions' in my Paintball arena that would cause a player to die if they entered them by flagging the WorldGuard region with: heal-delay: 1 heal-amount: -1 But this causes some odd behavior when a player dies in one of these regions while in a match. First of all, if the arena is configured to have more than one life per player, if a player dies in one of these regions while having no previous deaths, the game is ended (only tested in 1v1). This does on happen all the time though which makes the bug harder to fix.
The worst problem with this bug is that when a player dies in one of these regions while in a match and they had only one life left, the respawn at their normal spawn location and not where they should (like the lobby or previous location). When the player dies and the respawn screen shows, you can see the player be teleported where they should be (like the lobby or previous location), but since they have not actually respawned yet, when they do, the plugin does not recognize them as being in the game and they respawn at their normal spawn location. This is really annoying for the player, and especially because any items they had on them before joining the game, are lost...
Here is my transition configuration: defaults: options:
I have been going through your code trying to find the cause of the bug, and I have not been able to figure it out. So I think I will fork this plugin and debug it to locate the bug so I can make a temporary fix, but ultimately so you will be more inclined to fix this bug quickly! thanks.