testserver/patches/server/0352-Optimise-IEntityAccess...

27 lines
1.7 KiB
Diff
Raw Normal View History

2021-06-11 12:02:28 +00:00
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 704d5fd4038cd6913e0804b66da920cd661e93ee..2de2e890cbf74ba98ce0ae9d1ad1a8195eccf71f 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
2022-03-01 05:43:03 +00:00
@@ -385,6 +385,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
2021-06-13 19:29:58 +00:00
public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager;
2021-06-11 12:02:28 +00:00
// Paper end
+ // Paper start - optimise getPlayerByUUID
+ @Nullable
+ @Override
+ public Player getPlayerByUUID(UUID uuid) {
2021-06-13 19:29:58 +00:00
+ return this.getServer().getPlayerList().getPlayer(uuid);
2021-06-11 12:02:28 +00:00
+ }
+ // Paper end
+
// Add env and gen to constructor, WorldData -> WorldDataServer
2022-03-01 05:43:03 +00:00
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey<Level> resourcekey, Holder<DimensionType> holder, 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) {
2021-06-13 19:29:58 +00:00
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error