Spectator upon death doesn't work properly
Permanently opened this issue · 1 comments
Describe the bug
I don't think this description will be enough to cover it, so in this I've linked two videos.
The first one is when someone is simply assigned the spectator role. The game starts, and everything works perfectly. You can teleport into people, use the hotbar, clip into blocks, as normal.
The second one is when someone dies as a speedrunner and is converted to a spectator. The hotbar can't be used, block collisions don't allow you to clip under the ground, and the only way around this is to make a /fix command in commands.yml:
fix:
- gamemode adventure $$1
- gamemode spectator $$1
Which, somehow, sets everything back to normal.
Potential Causes
Kill a speedrunner, and have setRunnersToSpecOnDeath
set to true
.
Environment Info
Plugin version: 1.3.3.6
Bukkit/Spigot server version: 1.16.4-R0.1 (specifically, git-Tuinity-"f06591a", a Tuinity build)
Configuration file
The only part of the config.yml file that could potentially be relevant:
# Set to true to put runners in spectator mode when they die.
setRunnersToSpecOnDeath: true
Server Logs
Nothing at all. No errors, or even warnings.
Anything else?
You'd think this onPlayerDeath line would perform the same as the spectator team set gamemode line, but I don't know. I'm honestly not an expert in the Spigot API. ¯_(ツ)_/¯
Also not related, but sorry about messing up #44 (I'm really bad with Git), I re-requested in #45 :)
It's probably some kind of race condition— the server is doing stuff after a player respawns, and since the game mode is set basically the same tick as the other respawns logic is handled, weird side effects occur.
This is probably fixable by adding a 1 second delay after the respawn event is called and the game mode is set. I will get on this issue once I get a bit of time (and review your other PRs!)