Skip to content

Commit

Permalink
Merge pull request #724 from Waischbrot/patch-1
Browse files Browse the repository at this point in the history
fix NullPointer when sending custom sounds
  • Loading branch information
kernitus authored Mar 9, 2024
2 parents 3358fce + 11ee79a commit 976d31f
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ public void onPacketSending(PacketEvent packetEvent) {
try {
final PacketContainer packetContainer = packetEvent.getPacket();
final Sound sound = packetContainer.getSoundEffects().read(0);

//fix NullpointerException when sending a custom sound
if (sound == null) {
return;
}

final String soundName = sound.toString(); // Works for both string and namespaced key

if (blockedSounds.contains(soundName)) {
Expand Down

0 comments on commit 976d31f

Please sign in to comment.