aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0353-Optimise-IEntityAccess-getPlayerByUUID.patch
blob: b877d9624b654c4a7e9a1f1c0d589418aecfe63b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Sat, 11 Jan 2020 21:50:56 -0800
Subject: [PATCH] Optimise IEntityAccess#getPlayerByUUID

Use the world entity 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 fef3846a978dcba95c5dbe5c528ac20cb4f56178..c04402666b9219d508bfd32b4f2e3faea0c9b648 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -384,6 +384,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
     public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager;
     // Paper end
 
+    // Paper start - optimise getPlayerByUUID
+    @Nullable
+    @Override
+    public Player getPlayerByUUID(UUID uuid) {
+        return this.getServer().getPlayerList().getPlayer(uuid);
+    }
+    // Paper end
+
     // Add env and gen to constructor, WorldData -> WorldDataServer
     public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey<Level> resourcekey, DimensionType dimensionmanager, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
         // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error