Sponge: ServerBossBar player list is not updated on player respawn

Created on 21 May 2018  路  9Comments  路  Source: SpongePowered/Sponge

I am currently running

  • SpongeForge version: 1.12.2-2655-8.0.0-BETA-3102:dev
  • Java version: 1.8.0_162
  • Operating System: Windows 10

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 on ServerBossBar#getPlayers

How to reproduce
Using a plugin, create a ServerBossBar object, add a player in, print each second the position of all players in ServerBossBar#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.

bug 1.12

All 9 comments

@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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

therealmikz picture therealmikz  路  4Comments

Eufranio picture Eufranio  路  4Comments

Xemiru picture Xemiru  路  3Comments

randombyte-developer picture randombyte-developer  路  5Comments

DarkArc picture DarkArc  路  3Comments