mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-12-01 06:33:39 +01:00
35 lines
1.4 KiB
Diff
35 lines
1.4 KiB
Diff
From 4167f0bdc2fc9c5937241e90f1e748d9af493f21 Mon Sep 17 00:00:00 2001
|
|
From: Techcable <Techcable@techcable.net>
|
|
Date: Mon, 6 Jun 2016 13:36:10 -0600
|
|
Subject: [PATCH] Don't send KICK packets while in HANDSHAKE state
|
|
|
|
Use a switch statement for checking the state (best practice when you have lots of cases)
|
|
|
|
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
|
index 9d139c6..7a4c392 100644
|
|
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
|
@@ -540,10 +540,15 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|
{
|
|
if ( !ch.isClosed() && disconnecting.compareAndSet(false, true) )
|
|
{
|
|
- if ( thisState != State.STATUS && thisState != State.PING ) {
|
|
- ch.close( new Kick( ComponentSerializer.toString( reason ) ) );
|
|
- } else {
|
|
- ch.close();
|
|
+ switch (thisState) {
|
|
+ default:
|
|
+ ch.close(new Kick(ComponentSerializer.toString(reason)));
|
|
+ break;
|
|
+ case STATUS:
|
|
+ case PING:
|
|
+ case HANDSHAKE:
|
|
+ ch.close();
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
--
|
|
2.7.4
|
|
|