mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-24 01:09:29 +00:00
Updated Upstream (Purpur)
Upstream has released updates that appear to apply and compile correctly Purpur Changes: PurpurMC/Purpur@998a4e6 [ci skip] add a good chunk of patch identifying comments PurpurMC/Purpur@e440784 [ci skip] a couple more patch identifying comments PurpurMC/Purpur@c33391b Updated Upstream (Paper) PurpurMC/Purpur@8d7fab1 [ci skip] small patch comment cleanup
This commit is contained in:
43
patches/server/0029-Optimize-CraftServer.getWorld-UUID.patch
Normal file
43
patches/server/0029-Optimize-CraftServer.getWorld-UUID.patch
Normal file
@@ -0,0 +1,43 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 13 Jan 2024 13:36:55 +0300
|
||||
Subject: [PATCH] Optimize CraftServer.getWorld(UUID)
|
||||
|
||||
Original code by MultiPaper - https://github.com/MultiPaper/MultiPaper
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index eab64b3f812c9ab12793ad200f58ae8c49e214e1..88343cbdaa95f7f2bf6a196b58f23195186749a2 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -285,6 +285,7 @@ public final class CraftServer implements Server {
|
||||
protected final DedicatedPlayerList playerList;
|
||||
private final Map<String, World> worlds = new LinkedHashMap<String, World>();
|
||||
// private final Map<Class<?>, Registry<?>> registries = new HashMap<>(); // Paper - replace with RegistryAccess
|
||||
+ private final Map<UUID, World> worldsByUUID = new it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap<>(); // DivineMC - MultiPaper - optimize getWorld(UUID)
|
||||
private YamlConfiguration configuration;
|
||||
private YamlConfiguration commandsConfiguration;
|
||||
private final Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions()));
|
||||
@@ -1519,6 +1520,7 @@ public final class CraftServer implements Server {
|
||||
this.getLogger().log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
+ this.worldsByUUID.remove(world.getUID()); // DivineMC - MultiPaper - optimize getWorld(UUID)
|
||||
this.worlds.remove(world.getName().toLowerCase(Locale.ROOT));
|
||||
this.console.removeLevel(handle);
|
||||
return true;
|
||||
@@ -1537,6 +1539,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public World getWorld(UUID uid) {
|
||||
+ if (true) return this.worldsByUUID.get(uid); // DivineMC - MultiPaper - optimize getWorld(UUID)
|
||||
for (World world : this.worlds.values()) {
|
||||
if (world.getUID().equals(uid)) {
|
||||
return world;
|
||||
@@ -1560,6 +1563,7 @@ public final class CraftServer implements Server {
|
||||
System.out.println("World " + world.getName() + " is a duplicate of another world and has been prevented from loading. Please delete the uid.dat file from " + world.getName() + "'s world directory if you want to be able to load the duplicate world.");
|
||||
return;
|
||||
}
|
||||
+ this.worldsByUUID.put(world.getUID(), world); // DivineMC - MultiPaper - optimize getWorld(UUID)
|
||||
this.worlds.put(world.getName().toLowerCase(Locale.ROOT), world);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user