Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NPE when sending resource-packs in the configuration stage #181

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading