3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 21:10:17 +01:00
Paper/CraftBukkit-Patches/0031-Prevent-Shutdown-Hang.patch

33 Zeilen
1.3 KiB
Diff

2014-03-23 05:21:51 +01:00
From 2fb681c8b6ec9f26b4a3f43de21e39dc1b44e316 Mon Sep 17 00:00:00 2001
2013-06-11 03:54:45 +02:00
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
2014-03-23 05:21:51 +01:00
index 8b3d757..794bedd 100644
2013-06-11 03:54:45 +02:00
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
2014-03-23 05:21:51 +01:00
@@ -1129,8 +1129,15 @@ public abstract class PlayerList {
2013-12-01 04:40:53 +01:00
}
2013-06-11 03:54:45 +02:00
public void r() {
2013-12-01 04:40:53 +01:00
- 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()) {
2013-06-11 03:54:45 +02:00
+ // 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
}
}
--
2014-03-09 23:14:45 +01:00
1.8.3.2
2013-06-11 03:54:45 +02:00