mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-06 10:49:40 +01:00
33 lines
1.3 KiB
Diff
33 lines
1.3 KiB
Diff
|
From fc8347c234c1c8e323b35c07cb83aa94b00efa2e 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 e6012fb..9eb25df 100644
|
||
|
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||
|
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||
|
@@ -1152,8 +1152,15 @@ public abstract class PlayerList {
|
||
|
}
|
||
|
|
||
|
public void u() {
|
||
|
- for (int i = 0; i < this.players.size(); ++i) {
|
||
|
- ((EntityPlayer) this.players.get(i)).playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message
|
||
|
+ while (!this.players.isEmpty()) {
|
||
|
+ // 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.9.1
|
||
|
|