Update ChunkListener to fix a minor NPE bug

Fixes a NullPointerException at the root of the problem. Bukkit.getPlayer(UUID) can return a null value, so a simple null check will do the trick.
This commit is contained in:
A248 2019-11-06 19:00:04 -05:00 committed by GitHub
parent 81b2bc3569
commit b5621816cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -45,8 +45,12 @@ public class ChunkListener implements Listener {
if (npc.getAutoHidden().contains(uuid)) {
continue;
}
npc.hide(Bukkit.getPlayer(uuid), true);
// Bukkit.getPlayer(uuid) sometimes returns null
Player player = Bukkit.getPlayer(uuid);
if (player != null) {
npc.hide(player, true);
}
}
}
}