Allow players to join a forge server even if the AvailableCommandsPacket fails to be decoded

This commit is contained in:
FarmVivi 2024-07-22 20:23:07 +02:00
parent fbf12f90e7
commit e58682b84c

View File

@ -187,7 +187,12 @@ public enum VelocityForgeBackendConnectionPhase implements BackendConnectionPhas
public boolean handle(VelocityServerConnection server, ConnectedPlayer player, PluginMessagePacket message) {
if (message.getChannel().equals("ambassador:commands")) {
AvailableCommandsPacket packet = new AvailableCommandsPacket();
packet.decode(message.content(), ProtocolUtils.Direction.CLIENTBOUND,server.getConnection().getProtocolVersion());
try {
packet.decode(message.content(), ProtocolUtils.Direction.CLIENTBOUND, server.getConnection().getProtocolVersion());
} catch (Exception e) {
Ambassador.getInstance().logger.error("Failed to decode AvailableCommandsPacket", e);
return true;
}
server.getConnection().getActiveSessionHandler().handle(packet);
return true;
}