SPIGOT-5554: Clear error message when BossBar is used for not fully joined players

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2020-01-31 08:36:59 +11:00
parent c21bbaedfa
commit 7867f1cb3e

View file

@ -166,11 +166,16 @@ public class CraftBossBar implements BossBar {
@Override
public void addPlayer(Player player) {
Preconditions.checkArgument(player != null, "player == null");
Preconditions.checkArgument(((CraftPlayer) player).getHandle().playerConnection != null, "player is not fully connected (wait for PlayerJoinEvent)");
handle.addPlayer(((CraftPlayer) player).getHandle());
}
@Override
public void removePlayer(Player player) {
Preconditions.checkArgument(player != null, "player == null");
handle.removePlayer(((CraftPlayer) player).getHandle());
}