diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java index 303a3bf24..a38e3c03a 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/HandshakeSessionHandler.java @@ -132,6 +132,8 @@ public class HandshakeSessionHandler implements MinecraftSessionHandler { InetAddress address = ((InetSocketAddress) connection.getRemoteAddress()).getAddress(); if (!server.getIpAttemptLimiter().attempt(address)) { + // Bump connection into correct protocol state so that we can send the disconnect packet. + connection.setState(StateRegistry.LOGIN); ic.disconnectQuietly(Component.translatable("velocity.error.logging-in-too-fast")); return; } @@ -142,6 +144,8 @@ public class HandshakeSessionHandler implements MinecraftSessionHandler { // and lower, otherwise IP information will never get forwarded. if (server.getConfiguration().getPlayerInfoForwardingMode() == PlayerInfoForwarding.MODERN && handshake.getProtocolVersion().lessThan(ProtocolVersion.MINECRAFT_1_13)) { + // Bump connection into correct protocol state so that we can send the disconnect packet. + connection.setState(StateRegistry.LOGIN); ic.disconnectQuietly( Component.translatable("velocity.error.modern-forwarding-needs-new-client")); return;