Bump client connection state before sending disconnection packets
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user