Skip to content

Commit

Permalink
Fix exception if channel is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofaa2 authored Feb 12, 2024
1 parent 4bf35da commit 62fc93c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/me/tofaa/entitylib/EntityLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,12 @@ public static void verifyVersion(ServerVersion supported, String msg) {
@ApiStatus.Internal
public static void sendPacket(UUID user, PacketWrapper<?> wrapper) {
checkInit();
packetEvents.getProtocolManager().sendPacket(packetEvents.getProtocolManager().getChannel(user), wrapper);
Object channel = packetEvents.getProtocolManager().getChannel(user);
if (channel == null) {
System.out.println("EntityLib could not send packet to user " + user);
return;
}
packetEvents.getProtocolManager().sendPacket(channel, wrapper);
}

private static void checkInit() {
Expand Down

0 comments on commit 62fc93c

Please sign in to comment.