3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/Spigot-Server-Patches/0377-Optimize-GameRules-to-use-LinkedHashMap.patch
Shane Freeder 0708fa363b
Updated Upstream (CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
eb2e6578 SPIGOT-5116: Fix concurrent modification exception inside ChunkMapDistance
989f9b3d SPIGOT-4849: Fix server crash when accessing chunks during chunk load/unload/populate events
f554183c SPIGOT-5171: Don't fire PlayerTeleportEvent if not actually moving
2349feb8 SPIGOT-5163: Cancelling PlayerBucketFillEvent visually removes the targeted block

Spigot Changes:
9a643a6a Remove DataWatcher Locking
2019-07-16 23:09:32 +01:00

26 Zeilen
1.4 KiB
Diff

From e7b57e7f31ad9a9dc6d845cbd3e6ee5843b54d4a Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Thu, 4 Apr 2019 17:55:05 -0700
Subject: [PATCH] Optimize GameRules to use LinkedHashMap
Previously TreeMap was used which has poor get(K) performance.
diff --git a/src/main/java/net/minecraft/server/GameRules.java b/src/main/java/net/minecraft/server/GameRules.java
index 2880de7c5..d567f35bd 100644
--- a/src/main/java/net/minecraft/server/GameRules.java
+++ b/src/main/java/net/minecraft/server/GameRules.java
@@ -21,9 +21,7 @@ import org.apache.logging.log4j.Logger;
public class GameRules {
private static final Logger LOGGER = LogManager.getLogger();
- private static final Map<GameRules.GameRuleKey<?>, GameRules.GameRuleDefinition<?>> z = Maps.newTreeMap(Comparator.comparing((gamerules_gamerulekey) -> {
- return gamerules_gamerulekey.a;
- }));
+ private static final Map<GameRules.GameRuleKey<?>, GameRules.GameRuleDefinition<?>> z = Maps.newLinkedHashMap(); // Paper
public static final GameRules.GameRuleKey<GameRules.GameRuleBoolean> DO_FIRE_TICK = a("doFireTick", GameRules.GameRuleBoolean.b(true));
public static final GameRules.GameRuleKey<GameRules.GameRuleBoolean> MOB_GRIEFING = a("mobGriefing", GameRules.GameRuleBoolean.b(true));
public static final GameRules.GameRuleKey<GameRules.GameRuleBoolean> KEEP_INVENTORY = a("keepInventory", GameRules.GameRuleBoolean.b(false));
--
2.22.0