From 9920287a0f04fdc3a6e4f3e7124031cd01dc3e81 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> Date: Sat, 18 Aug 2018 03:58:53 -0500 Subject: [PATCH] Don't iterate twice - Fixes GH-1346 --- ...ackets-from-world-player-list-not-serve.patch | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Spigot-Server-Patches/Send-nearby-packets-from-world-player-list-not-serve.patch b/Spigot-Server-Patches/Send-nearby-packets-from-world-player-list-not-serve.patch index 26ff4040ca..9747e155d6 100644 --- a/Spigot-Server-Patches/Send-nearby-packets-from-world-player-list-not-serve.patch +++ b/Spigot-Server-Patches/Send-nearby-packets-from-world-player-list-not-serve.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Send nearby packets from world player list not server list diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index eaaa54ac..44ced604 100644 +index eaaa54acd..44ced604a 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -46,7 +46,7 @@ index eaaa54ac..44ced604 100644 double d5 = d1 - entityplayer.locY; double d6 = d2 - entityplayer.locZ; diff --git a/src/main/java/net/minecraft/server/WorldManager.java b/src/main/java/net/minecraft/server/WorldManager.java -index 2c8fb705..a986e947 100644 +index 2c8fb705d..bfe003f60 100644 --- a/src/main/java/net/minecraft/server/WorldManager.java +++ b/src/main/java/net/minecraft/server/WorldManager.java @@ -0,0 +0,0 @@ public class WorldManager implements IWorldAccess { @@ -86,14 +86,16 @@ index 2c8fb705..a986e947 100644 + java.util.List list = entity != null ? entity.world.players : this.a.getPlayerList().v(); + Iterator iterator = list.iterator(); while (iterator.hasNext()) { +- EntityPlayer entityplayer = (EntityPlayer) iterator.next(); + EntityHuman human = iterator.next(); + if (!(human instanceof EntityPlayer)) continue; ++ EntityPlayer entityplayer = (EntityPlayer) human; + // Paper end - EntityPlayer entityplayer = (EntityPlayer) iterator.next(); if (entityplayer != null && entityplayer.world == this.world && entityplayer.getId() != i) { + double d0 = (double) blockposition.getX() - entityplayer.locX; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 9fe5c440..8768b0b8 100644 +index a14b5e061..b19942e0f 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { @@ -117,7 +119,7 @@ index 9fe5c440..8768b0b8 100644 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 210e3bc4..170c937a 100644 +index ccff6fd05..567e9acb1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld implements World { @@ -129,6 +131,4 @@ index 210e3bc4..170c937a 100644 } public String getGameRuleValue(String rule) { --- -2.18.0.rc2.windows.1 - +-- \ No newline at end of file