From 119fbc86bc36f0cf2c1373ae462493386a47d2e6 Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 22 Nov 2023 22:03:24 +0100 Subject: [PATCH] Don't send an awkward "null" when a exeption disconnect cause doesn't have a message (#4306) * Don't send an awkward "null" when a cause doesn't have a message * Fix accidental regression leading to unhandled "CraftingEventPackets" --- .../org/geysermc/geyser/network/LoggingPacketHandler.java | 5 +++++ .../java/org/geysermc/geyser/session/GeyserSession.java | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java b/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java index ec1bef1df..80e624895 100644 --- a/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java +++ b/core/src/main/java/org/geysermc/geyser/network/LoggingPacketHandler.java @@ -115,6 +115,11 @@ public class LoggingPacketHandler implements BedrockPacketHandler { return defaultHandler(packet); } + @Override + public PacketSignal handle(CraftingEventPacket packet) { + return defaultHandler(packet); + } + @Override public PacketSignal handle(EntityEventPacket packet) { return defaultHandler(packet); diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index ebb0025da..9bfb4e01c 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -1039,7 +1039,11 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.disconnect", authData.name(), remoteServer.address(), disconnectMessage)); } if (cause != null) { - GeyserImpl.getInstance().getLogger().error(cause.getMessage()); + if (cause.getMessage() != null) { + GeyserImpl.getInstance().getLogger().error(cause.getMessage()); + } else { + GeyserImpl.getInstance().getLogger().error("An exception occurred: ", cause); + } // GeyserSession is disconnected via session.disconnect() called indirectly be the server // This only needs to be "initiated" here when there is an exception, hence the cause clause GeyserSession.this.disconnect(disconnectMessage);