Open Yeregorix opened 6 years ago
@Yeregorix Can you reproduce this on stable-7 ?
Good question, I will try 🤔
This issue also affects SV 1.12.2-7.1.0-BETA-111 and SF 1.12.2-2705-7.1.0-BETA-3422.
I searched a bit and it seems it's a Minecraft "behavior".
It seems the BossInfoServer
is only updated when a player enters or leaves a boss zone, but not when a player is killed and respawned.
It can be easily fixed by a plugin by listening to RespawnPlayerEvent
to restore the bossbar to the player based on the getOriginalPlayer
return value.
But it needs a fix in Sponge IMO.
I don't think we should be fixing minecraft intended behaviour. If it's a bug with the game, you need to open an issue on their issue tracker.
@ImMorpheus
It is a bug, not intended behavior and likely something they missed internally when testing bars. Generally one doesn't respawn on top of a boss. Fixing this in Sponge doesn't break any behavior, just because the Player object got re-created doesn't mean the Player isn't still applicable to the bar in question (again so long as they are within range of it). This wouldn't be the first time we've fixed Vanilla bugs like this.
I think it's neither a bug, neither an intended behavior, in vanilla, boss bars are removed on player death, Mojang just didn't thought that some developers will use boss bars in other situations. Anyway, it would be easier for plugin developers if Sponge API can guarantee that getPlayers()
never contains an outdated Player
object.
@Yeregorix
It is a bug lol. They just didn't remove the old object and then add you back to the bar after respawn if you're still in range of it. It is a consequence of how they handle respawn itself. You fix that and then the List is fine lol.
In addition, the boss bar commands are a first class minecraft feature in 1.13.
I am currently running
Issue Description I found while testing a private plugin that when a player die, the player object is recreated but the player list in a
ServerBossBar
object is not updated. Therefore it causes issues for plugins depending onServerBossBar#getPlayers
How to reproduce Using a plugin, create a
ServerBossBar
object, add a player in, print each second the position of all players inServerBossBar#getPlayers
. In game, at the beginning, printed positions will correspond the player position. Now, kill the player, new printed positions will no longer be synced with player position but it will print the world spawn position.