Duplicate Disconnect Prevention. In 1.7 mojang removed the this.disconnected flag. We add it back to prevent users from forcibly disconnecting themselves in a short amount of time.

This commit is contained in:
md_5 2013-12-05 16:33:50 +11:00
parent 1e4407fd04
commit a98a7ce919

View File

@ -0,0 +1,42 @@
From 61c2328ff2a651da8acb3c932e6b063e42071006 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Thu, 5 Dec 2013 16:33:16 +1100
Subject: [PATCH] Duplicate Disconnect Prevention
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 5534bc3..35c66c6 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -77,6 +77,7 @@ public class PlayerConnection implements PacketPlayInListener {
private double z;
private double q;
public boolean checkMovement = true; // CraftBukkit - private -> public
+ private boolean disconnected; // Spigot
public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
this.minecraftServer = minecraftserver;
@@ -149,6 +150,12 @@ public class PlayerConnection implements PacketPlayInListener {
}
public void disconnect(String s) {
+ // Spigot Start
+ if ( disconnected )
+ {
+ return;
+ }
+ // Spigot End
// CraftBukkit start
String leaveMessage = EnumChatFormat.YELLOW + this.player.getName() + " left the game.";
@@ -170,6 +177,7 @@ public class PlayerConnection implements PacketPlayInListener {
this.networkManager.handle(new PacketPlayOutKickDisconnect(chatcomponenttext), new GenericFutureListener[] { new PlayerConnectionFuture(this, chatcomponenttext)});
this.a(chatcomponenttext); // CraftBukkit - Process quit immediately
this.networkManager.g();
+ disconnected = true; // Spigot
}
public void a(PacketPlayInSteerVehicle packetplayinsteervehicle) {
--
1.8.3.2