diff options
Diffstat (limited to 'patches/server/0304-Optimise-EntityGetter-getPlayerByUUID.patch')
-rw-r--r-- | patches/server/0304-Optimise-EntityGetter-getPlayerByUUID.patch | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/patches/server/0304-Optimise-EntityGetter-getPlayerByUUID.patch b/patches/server/0304-Optimise-EntityGetter-getPlayerByUUID.patch new file mode 100644 index 0000000000..6ffcd9f3c3 --- /dev/null +++ b/patches/server/0304-Optimise-EntityGetter-getPlayerByUUID.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf <[email protected]> +Date: Sat, 11 Jan 2020 21:50:56 -0800 +Subject: [PATCH] Optimise EntityGetter#getPlayerByUUID + +Use the PlayerList map instead of iterating over all players + +diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java +index a6a21def1ae0d35fa106da6242c49a0928e4eda5..c85d5b941b5cb1c37cd2619d419006c5956f6eaf 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -330,6 +330,15 @@ public class ServerLevel extends Level implements WorldGenLevel { + } + // Paper end + ++ // Paper start - optimise getPlayerByUUID ++ @Nullable ++ @Override ++ public Player getPlayerByUUID(UUID uuid) { ++ final Player player = this.getServer().getPlayerList().getPlayer(uuid); ++ return player != null && player.level() == this ? player : null; ++ } ++ // Paper end - optimise getPlayerByUUID ++ + // Add env and gen to constructor, IWorldDataServer -> WorldDataServer + public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { + // IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess(); // CraftBukkit - decompile error |