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"
This commit is contained in:
chris 2023-11-22 22:03:24 +01:00 committed by GitHub
parent 44174fdc04
commit 119fbc86bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -115,6 +115,11 @@ public class LoggingPacketHandler implements BedrockPacketHandler {
return defaultHandler(packet); return defaultHandler(packet);
} }
@Override
public PacketSignal handle(CraftingEventPacket packet) {
return defaultHandler(packet);
}
@Override @Override
public PacketSignal handle(EntityEventPacket packet) { public PacketSignal handle(EntityEventPacket packet) {
return defaultHandler(packet); return defaultHandler(packet);

View file

@ -1039,7 +1039,11 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.disconnect", authData.name(), remoteServer.address(), disconnectMessage)); geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.remote.disconnect", authData.name(), remoteServer.address(), disconnectMessage));
} }
if (cause != null) { if (cause != null) {
if (cause.getMessage() != null) {
GeyserImpl.getInstance().getLogger().error(cause.getMessage()); 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 // 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 // This only needs to be "initiated" here when there is an exception, hence the cause clause
GeyserSession.this.disconnect(disconnectMessage); GeyserSession.this.disconnect(disconnectMessage);