Eredrim / pvparena

Controlled violence since 2011
https://www.spigotmc.org/resources/pvp-arena.16584/
GNU General Public License v3.0
23 stars 36 forks source link

Fix player not being teleported back from arena after quitting the game #131

Closed oskarkk closed 1 year ago

oskarkk commented 3 years ago

On my (mostly survival) server I have an inaccessible arena, which you can enter only by /pa arena and leave by /pa leave. When you're inside it and you quit the game, you become locked, because teleporting players leaving an arena is for some reason ("in order to avoid player death bug") postponed by 2 ticks. After these two ticks there's no player to teleport, so when the player comes back, he's still inside the arena (and, on my server, can't leave it).

I've implemented some workaround, by adding ArenaPlayer.quitting property, which, if true, allows to bypass that 2 tick wait time.

DISCLAIMER: Editing this plugin is literally the first thing I've ever done in Java, and also the first thing I touched which has so many objects, so expect silly mistakes and bad object code 😉

Oruss7 commented 3 years ago

Technically, it's okay, but not sure for functionally . Maybe @Eredrim can check it 🙏 Personally, I will check on player join event, if the player stand in an arena, teleport him to the exit spawn point.

oskarkk commented 3 years ago

While teleporting on join would work, I don't think it's an "elegant" solution to the problem. It wouldn't work if you deleted an arena, deleted the plugin data or removed the plugin. When disabling the plugin or removing an arena, you should be sure that every player was already teleported to where he should be and not be stuck in an arena.

Maybe the whole fix of this "player death bug" could be done another way? Or maybe it isn't needed anymore? Here's the commit and issues that introduced this fix:

18 & #25

https://github.com/Eredrim/pvparena/commit/2c528d6fa00f04f50ca0edef4d228ffed706581e

By looking at these threads I see that it's a mysterious bug.

Oruss7 commented 3 years ago

We rewrite the death system in v2 and we worried about side effects of your fix. I think, I will close your PR.

I note this for testing in v2. This shouldn't happen. But thank you for participating to pvpArena, we really appreciate it :heart:

Eredrim commented 1 year ago

Fixed in 2.0 (by a different way)