mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-03 01:10:37 +01:00
31 lines
1.2 KiB
Diff
31 lines
1.2 KiB
Diff
From 88c21014a866791f3be6e9b2c8778eb6dda3d506 Mon Sep 17 00:00:00 2001
|
|
From: md_5 <md_5@live.com.au>
|
|
Date: Tue, 11 Jun 2013 11:54:32 +1000
|
|
Subject: [PATCH] Prevent Shutdown Hang
|
|
|
|
Prevents server hanging if players disconnect during the shutdown sequence.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
|
index d5387f3..e5d2710 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
|
@@ -1071,7 +1071,14 @@ public abstract class PlayerList {
|
|
|
|
public void r() {
|
|
while (!this.players.isEmpty()) {
|
|
- ((EntityPlayer) this.players.get(0)).playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message
|
|
+ // Spigot start
|
|
+ EntityPlayer p = (EntityPlayer) this.players.get( 0 );
|
|
+ p.playerConnection.disconnect( this.server.server.getShutdownMessage() );
|
|
+ if ( ( !this.players.isEmpty() ) && ( this.players.get( 0 ) == p ) )
|
|
+ {
|
|
+ this.players.remove( 0 ); // Prevent shutdown hang if already disconnected
|
|
+ }
|
|
+ // Spigot end
|
|
}
|
|
}
|
|
|
|
--
|
|
1.8.1.2
|
|
|