mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-21 16:09:19 +00:00
fix async mob spawning TRACKED entities not count (#393)
* fix unloaded and TRACKED entities not count #392 * move to archived
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
Date: Sat, 24 Dec 2022 13:09:34 +0100
|
||||
Subject: [PATCH] CraftBukkit UUID to world map
|
||||
|
||||
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
Gale - https://galemc.org
|
||||
|
||||
This patch is based on the following patch:
|
||||
"Optimize CraftServer.getWorld(UUID)"
|
||||
By: PureGero <puregero@gmail.com>
|
||||
As part of: MultiPaper (https://github.com/MultiPaper/MultiPaper)
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index db4bbabf5f6c24a32fb96f0ce5e642adb468c805..3c671beafb9b0dafbf3ef9583244118462c4cab3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -287,6 +287,7 @@ public final class CraftServer implements Server {
|
||||
final DedicatedServer console;
|
||||
private final DedicatedPlayerList playerList;
|
||||
private final Map<String, World> worlds = new LinkedHashMap<>();
|
||||
+ private final it.unimi.dsi.fastutil.objects.Object2ObjectMap<UUID, World> worldsByUUID = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(); // Gale - MultiPaper - CraftBukkit UUID to world map
|
||||
private YamlConfiguration configuration;
|
||||
private YamlConfiguration commandsConfiguration;
|
||||
private final Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions()));
|
||||
@@ -1484,6 +1485,7 @@ public final class CraftServer implements Server {
|
||||
this.getLogger().log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
+ this.worldsByUUID.remove(world.getUID()); // Gale - MultiPaper - CraftBukkit UUID to world map
|
||||
this.worlds.remove(world.getName().toLowerCase(Locale.ROOT));
|
||||
this.console.removeLevel(handle);
|
||||
return true;
|
||||
@@ -1502,12 +1504,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public World getWorld(UUID uid) {
|
||||
- for (World world : this.worlds.values()) {
|
||||
- if (world.getUID().equals(uid)) {
|
||||
- return world;
|
||||
- }
|
||||
- }
|
||||
- return null;
|
||||
+ return this.worldsByUUID.get(uid); // Gale - MultiPaper - CraftBukkit UUID to world map
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1523,6 +1520,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); // Gale - MultiPaper - CraftBukkit UUID to world map
|
||||
this.worlds.put(world.getName().toLowerCase(Locale.ROOT), world);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user