From 9988ca1c1d436b1606fa2cf8f49ff62c6fdb822f Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sun, 24 Mar 2019 20:34:32 +0000 Subject: [PATCH] Don't update entity trackers for worlds without players PlayerList#moveToWorld already untracks the player from the player list, meaning that we do not need to worry about this untracking players who've left the world, The server also untracks a player during disconnect, handing yet another case. If we don't need to untrack players who've left the world, it should be reasonably save to do this, as we're not going to be performing any server->client updates here, which is what this code is intended to do, and all players should be untracked. --- ...ity-trackers-for-worlds-without-play.patch | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Spigot-Server-Patches/Don-t-update-entity-trackers-for-worlds-without-play.patch diff --git a/Spigot-Server-Patches/Don-t-update-entity-trackers-for-worlds-without-play.patch b/Spigot-Server-Patches/Don-t-update-entity-trackers-for-worlds-without-play.patch new file mode 100644 index 0000000000..47a4e24743 --- /dev/null +++ b/Spigot-Server-Patches/Don-t-update-entity-trackers-for-worlds-without-play.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Sun, 24 Mar 2019 18:52:31 +0000 +Subject: [PATCH] Don't update entity trackers for worlds without players + +PlayerList#moveToWorld already untracks the player from the player list, +meaning that we do not need to worry about this untracking players +who've left the world, The server also untracks a player during +disconnect, handing yet another case. + +If we don't need to untrack players who've left the world, it should be +reasonably save to do this, as we're not going to be performing any +server->client updates here, which is what this code is intended to do, +and all players should be untracked. + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index ce39ea09e8..b93fccf919 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati + + this.methodProfiler.exit(); + this.methodProfiler.enter("tracker"); +- worldserver.getTracker().updatePlayers(); ++ if (playerList.players.size() > 0) worldserver.getTracker().updatePlayers(); // Paper - No players, why spend time tracking them? (See patch) + this.methodProfiler.exit(); + this.methodProfiler.exit(); + worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions +-- \ No newline at end of file