Fix packet listeners not being called if there is no default listener

This commit is contained in:
themode 2021-01-05 18:10:25 +01:00
parent 3a7ae11c56
commit 852391f210

View File

@ -71,8 +71,7 @@ public final class PacketListenerManager {
// Listener can be null if none has been set before, call PacketConsumer anyway
if (packetListenerConsumer == null) {
LOGGER.error("Packet " + clazz + " does not have any default listener! (The issue comes from Minestom)");
return;
LOGGER.warn("Packet " + clazz + " does not have any default listener! (The issue comes from Minestom)");
}
final PacketController packetController = new PacketController();
@ -84,7 +83,9 @@ public final class PacketListenerManager {
return;
// Finally execute the listener
packetListenerConsumer.accept(packet, player);
if (packetListenerConsumer != null) {
packetListenerConsumer.accept(packet, player);
}
}
/**