From df371c1b69b3c8e751680b4429e0a0e7bab664d9 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 31 Jan 2020 08:36:59 +1100 Subject: [PATCH] SPIGOT-5554: Clear error message when BossBar is used for not fully joined players --- src/main/java/org/bukkit/craftbukkit/boss/CraftBossBar.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/bukkit/craftbukkit/boss/CraftBossBar.java b/src/main/java/org/bukkit/craftbukkit/boss/CraftBossBar.java index d1033d73d4..4a7e5fde00 100644 --- a/src/main/java/org/bukkit/craftbukkit/boss/CraftBossBar.java +++ b/src/main/java/org/bukkit/craftbukkit/boss/CraftBossBar.java @@ -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()); }