mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-11-28 13:15:31 +01:00
Don't send KICK packets while in HANDSHAKE state
Fixes #12 Use a switch statement for checking if the state has a kick packet for better readibility.
This commit is contained in:
parent
c5752cf13d
commit
2de1d93d7f
@ -0,0 +1,34 @@
|
||||
From 96bf7a93e9168180264c32a1b046794707ca7d26 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 8c19974..8bafc6b 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
|
||||
@@ -534,10 +534,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.3
|
||||
|
Loading…
Reference in New Issue
Block a user