Fix some players not being kicked on shutdown

Closes GH-8
This commit is contained in:
Jedediah Smith 2016-04-13 16:02:59 -05:00 committed by Zach Brown
parent 15cdfc7472
commit 7ab9a51731
2 changed files with 29 additions and 2 deletions

View File

@ -1,4 +1,4 @@
From 7db15879def797030fee0b06144841db99e44c98 Mon Sep 17 00:00:00 2001
From 2c0e6a7dc46e9b8862871d672e57651b019f5cd6 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Tue, 1 Mar 2016 14:47:52 -0600
Subject: [PATCH] Player affects spawning API
@ -10,7 +10,7 @@ index 11388ab..767c384 100644
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -1,6 +1,7 @@
package net.minecraft.server;
import com.google.common.base.Charsets;
+import com.google.common.base.Predicate; // Paper
import com.google.common.collect.Lists;

View File

@ -0,0 +1,27 @@
From 56ac5514f341eb1a9b4ca36bce41ba88181b214c Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Tue, 29 Mar 2016 20:19:20 -0400
Subject: [PATCH] Fix some players not being kicked on shutdown
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 94f122d..d4de4e9 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -1292,9 +1292,11 @@ 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
+ // Paper start - Fix players being skipped due to concurrent list modification
+ for (EntityPlayer player : com.google.common.collect.ImmutableList.copyOf(this.players)) {
+ player.playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message
}
+ // Paper end
}
--
2.8.0