Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
28 Zeilen
1.7 KiB
Diff
28 Zeilen
1.7 KiB
Diff
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 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 0635f84d062872a9a6e38a9ba3fe71026661e651..79f09d83e10e3d357cfe1537ab7cdde8b494d9d2 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -426,6 +426,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
}
|
|
// Paper end - rewrite chunk system
|
|
|
|
+ // 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
|
|
+
|
|
// 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, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
|
|
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error
|