Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 4890a53

Browse files
GrabskyOliverSchlueter
authored andcommitted
Possible fix for NPE being thrown when sending resource-packs in the configuration stage (#181)
(cherry picked from commit 62c42c0)
1 parent 4cdd978 commit 4890a53

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/java/de/oliver/fancyholograms/listeners/PlayerListener.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ public void onWorldChange(@NotNull final PlayerChangedWorldEvent event) {
7272

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

0 commit comments

Comments
 (0)