From 979c900640b5e787da6f9acffc03342b9790c823 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Wed, 26 Jun 2019 03:11:29 +0100 Subject: [PATCH] Fix raids throwing an UnsupportedOperationException --- ...CME-from-raids.patch => Fix-Raids-CME.patch} | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) rename Spigot-Server-Patches/{Fix-CME-from-raids.patch => Fix-Raids-CME.patch} (51%) diff --git a/Spigot-Server-Patches/Fix-CME-from-raids.patch b/Spigot-Server-Patches/Fix-Raids-CME.patch similarity index 51% rename from Spigot-Server-Patches/Fix-CME-from-raids.patch rename to Spigot-Server-Patches/Fix-Raids-CME.patch index 1527171cd6..a093231f4c 100644 --- a/Spigot-Server-Patches/Fix-CME-from-raids.patch +++ b/Spigot-Server-Patches/Fix-Raids-CME.patch @@ -1,20 +1,27 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Shane Freeder -Date: Wed, 26 Jun 2019 01:20:55 +0100 -Subject: [PATCH] Fix CME from raids +Date: Wed, 26 Jun 2019 03:04:45 +0100 +Subject: [PATCH] Fix Raids CME -Use the iterator to remove elements diff --git a/src/main/java/net/minecraft/server/Raid.java b/src/main/java/net/minecraft/server/Raid.java -index 6c1bbefd71..58c33f1000 100644 +index 6c1bbefd71..72f76d6c02 100644 --- a/src/main/java/net/minecraft/server/Raid.java +++ b/src/main/java/net/minecraft/server/Raid.java @@ -0,0 +0,0 @@ public class Raid { + private void y() { + Collection collection = this.r.getPlayers(); + Set set = Sets.newHashSet(collection); +- Iterator iterator = collection.iterator(); ++ Iterator iterator = set.iterator(); // Paper - use the set, this doesn't get modified out of scope + + while (iterator.hasNext()) { + EntityPlayer entityplayer = (EntityPlayer) iterator.next(); BlockPosition blockposition = new BlockPosition(entityplayer); if (this.k.c_(blockposition) != this) { - set.remove(entityplayer); -+ iterator.remove(); // Paper - Use iterator ++ iterator.remove(); // Paper this.r.removePlayer(entityplayer); } }