mirror of
https://github.com/PaperMC/Waterfall.git
synced 2025-02-02 21:11:47 +01:00
35 lines
1.4 KiB
Diff
35 lines
1.4 KiB
Diff
From fe96d6163b2fcbceb6ea28617a8a871983232136 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 378231c..132b73d 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.8.2
|
|
|