Fix exception if channel is null

This commit is contained in:
Tofaa 2024-02-12 18:21:23 +04:00 committed by GitHub
parent 4bf35da867
commit 62fc93c4c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -327,7 +327,12 @@ public final class EntityLib {
@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() {