Skip to content

Commit

Permalink
Possible fix for NPE being thrown when sending resource-packs in the …
Browse files Browse the repository at this point in the history
…configuration stage
  • Loading branch information
Grabsky committed Jan 5, 2025
1 parent 1a3aa80 commit 513527d
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ public void onWorldChange(@NotNull final PlayerChangedWorldEvent event) {

@EventHandler(priority = EventPriority.MONITOR)
public void onResourcePackStatus(@NotNull final PlayerResourcePackStatusEvent event) {
// Skipping event calls before player has fully loaded to the server.
// This should fix NPE due to vanillaPlayer.connection being null when sending resource-packs in the configuration stage.
if (!event.getPlayer().isOnline())
return;
final UUID playerUniqueId = event.getPlayer().getUniqueId();
final UUID packUniqueId = getResourcePackID(event);
// Adding accepted resource-pack to the list of currently loading resource-packs for that player.
Expand Down

0 comments on commit 513527d

Please sign in to comment.