diff --git a/patches/server/0077-Replace-throttle-tracker-map-with-optimized-collecti.patch b/patches/server/0077-Replace-throttle-tracker-map-with-optimized-collecti.patch new file mode 100644 index 0000000..c6391a7 --- /dev/null +++ b/patches/server/0077-Replace-throttle-tracker-map-with-optimized-collecti.patch @@ -0,0 +1,94 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Martijn Muijsers +Date: Fri, 23 Dec 2022 22:22:47 +0100 +Subject: [PATCH] Replace throttle tracker map with optimized collection + +License: MIT (https://opensource.org/licenses/MIT) +Gale - https://galemc.org + +This patch is based on the following patch: +"Use more fastutil data structures" +By: nopjmp +As part of: Dionysus (https://github.com/nopjmp/Dionysus) +Licensed under: MIT (https://opensource.org/licenses/MIT) + +* Dionysus description * + +Use them in more places. + +* Dionysus copyright * + +Copyright 2021 Kayla Thompson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +index e7ff7ad3bf4dd17fdd34202ec3aef8e9512bc36d..8e68d1373a519cc12bf83de6aadcb24cbbd34af6 100644 +--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +@@ -1,10 +1,11 @@ + package net.minecraft.server.network; + ++import it.unimi.dsi.fastutil.objects.Object2LongMap; ++import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; + import net.minecraft.SharedConstants; + import net.minecraft.network.Connection; + import net.minecraft.network.ConnectionProtocol; + import net.minecraft.network.chat.Component; +-import net.minecraft.network.chat.MutableComponent; + import net.minecraft.network.protocol.handshake.ClientIntentionPacket; + import net.minecraft.network.protocol.handshake.ServerHandshakePacketListener; + import net.minecraft.network.protocol.login.ClientboundLoginDisconnectPacket; +@@ -12,7 +13,8 @@ import net.minecraft.server.MinecraftServer; + + // CraftBukkit start + import java.net.InetAddress; +-import java.util.HashMap; ++import java.util.Iterator; ++import java.util.Map; + // CraftBukkit end + + public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketListener { +@@ -23,7 +25,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL + static final java.util.regex.Pattern PROP_PATTERN = java.util.regex.Pattern.compile("\\w{0,16}"); + // Spigot end + // CraftBukkit start - add fields +- private static final HashMap throttleTracker = new HashMap(); ++ private static final Object2LongOpenHashMap throttleTracker = new Object2LongOpenHashMap<>(); // Gale - Dionysus - replace throttle tracker map with optimized collection + private static int throttleCounter = 0; + // CraftBukkit end + private static final Component IGNORE_STATUS_REASON = Component.literal("Ignoring status request"); +@@ -50,7 +52,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL + InetAddress address = ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getAddress(); + + synchronized (ServerHandshakePacketListenerImpl.throttleTracker) { +- if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.get(address) < connectionThrottle) { ++ if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.getLong(address) < connectionThrottle) { // Gale - Dionysus - replace throttle tracker map with optimized collection + ServerHandshakePacketListenerImpl.throttleTracker.put(address, currentTime); + Component chatmessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.connectionThrottle); // Paper - Configurable connection throttle kick message + this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage)); +@@ -64,13 +66,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL + ServerHandshakePacketListenerImpl.throttleCounter = 0; + + // Cleanup stale entries +- java.util.Iterator iter = ServerHandshakePacketListenerImpl.throttleTracker.entrySet().iterator(); +- while (iter.hasNext()) { +- java.util.Map.Entry entry = (java.util.Map.Entry) iter.next(); +- if (entry.getValue() > connectionThrottle) { +- iter.remove(); +- } +- } ++ throttleTracker.object2LongEntrySet().removeIf(entry -> entry.getLongValue() > connectionThrottle); // Gale - Dionysus - replace throttle tracker map with optimized collection + } + } + } // Paper - add closing bracket for if check above diff --git a/patches/server/0077-Replace-shape-full-block-cache-with-hashtable.patch b/patches/server/0078-Replace-shape-full-block-cache-with-hashtable.patch similarity index 100% rename from patches/server/0077-Replace-shape-full-block-cache-with-hashtable.patch rename to patches/server/0078-Replace-shape-full-block-cache-with-hashtable.patch diff --git a/patches/server/0078-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch b/patches/server/0079-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch similarity index 100% rename from patches/server/0078-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch rename to patches/server/0079-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch diff --git a/patches/server/0079-Cache-BlockStatePairKey-hash.patch b/patches/server/0080-Cache-BlockStatePairKey-hash.patch similarity index 100% rename from patches/server/0079-Cache-BlockStatePairKey-hash.patch rename to patches/server/0080-Cache-BlockStatePairKey-hash.patch diff --git a/patches/server/0080-Cache-CubeVoxelShape-shape-array.patch b/patches/server/0081-Cache-CubeVoxelShape-shape-array.patch similarity index 100% rename from patches/server/0080-Cache-CubeVoxelShape-shape-array.patch rename to patches/server/0081-Cache-CubeVoxelShape-shape-array.patch diff --git a/patches/server/0081-Replace-division-by-multiplication-in-CubePointRange.patch b/patches/server/0082-Replace-division-by-multiplication-in-CubePointRange.patch similarity index 100% rename from patches/server/0081-Replace-division-by-multiplication-in-CubePointRange.patch rename to patches/server/0082-Replace-division-by-multiplication-in-CubePointRange.patch diff --git a/patches/server/0082-Replace-parts-by-size-in-CubePointRange.patch b/patches/server/0083-Replace-parts-by-size-in-CubePointRange.patch similarity index 100% rename from patches/server/0082-Replace-parts-by-size-in-CubePointRange.patch rename to patches/server/0083-Replace-parts-by-size-in-CubePointRange.patch diff --git a/patches/server/0083-Check-frozen-ticks-before-landing-block.patch b/patches/server/0084-Check-frozen-ticks-before-landing-block.patch similarity index 100% rename from patches/server/0083-Check-frozen-ticks-before-landing-block.patch rename to patches/server/0084-Check-frozen-ticks-before-landing-block.patch diff --git a/patches/server/0084-Faster-chunk-serialization.patch b/patches/server/0085-Faster-chunk-serialization.patch similarity index 100% rename from patches/server/0084-Faster-chunk-serialization.patch rename to patches/server/0085-Faster-chunk-serialization.patch diff --git a/patches/server/0085-Update-boss-bar-within-tick.patch b/patches/server/0086-Update-boss-bar-within-tick.patch similarity index 100% rename from patches/server/0085-Update-boss-bar-within-tick.patch rename to patches/server/0086-Update-boss-bar-within-tick.patch diff --git a/patches/server/0086-Cache-ominous-banner-item.patch b/patches/server/0087-Cache-ominous-banner-item.patch similarity index 100% rename from patches/server/0086-Cache-ominous-banner-item.patch rename to patches/server/0087-Cache-ominous-banner-item.patch diff --git a/patches/server/0087-Precompute-piston-shapes.patch b/patches/server/0088-Precompute-piston-shapes.patch similarity index 100% rename from patches/server/0087-Precompute-piston-shapes.patch rename to patches/server/0088-Precompute-piston-shapes.patch diff --git a/patches/server/0088-Optimize-world-generation-chunk-and-block-access.patch b/patches/server/0089-Optimize-world-generation-chunk-and-block-access.patch similarity index 100% rename from patches/server/0088-Optimize-world-generation-chunk-and-block-access.patch rename to patches/server/0089-Optimize-world-generation-chunk-and-block-access.patch diff --git a/patches/server/0089-Cache-world-generator-sea-level.patch b/patches/server/0090-Cache-world-generator-sea-level.patch similarity index 100% rename from patches/server/0089-Cache-world-generator-sea-level.patch rename to patches/server/0090-Cache-world-generator-sea-level.patch diff --git a/patches/server/0090-Skip-entity-move-if-movement-is-zero.patch b/patches/server/0091-Skip-entity-move-if-movement-is-zero.patch similarity index 100% rename from patches/server/0090-Skip-entity-move-if-movement-is-zero.patch rename to patches/server/0091-Skip-entity-move-if-movement-is-zero.patch diff --git a/patches/server/0091-Store-mob-counts-in-an-array.patch b/patches/server/0092-Store-mob-counts-in-an-array.patch similarity index 100% rename from patches/server/0091-Store-mob-counts-in-an-array.patch rename to patches/server/0092-Store-mob-counts-in-an-array.patch diff --git a/patches/server/0092-Use-linked-map-for-entity-trackers.patch b/patches/server/0093-Use-linked-map-for-entity-trackers.patch similarity index 100% rename from patches/server/0092-Use-linked-map-for-entity-trackers.patch rename to patches/server/0093-Use-linked-map-for-entity-trackers.patch diff --git a/patches/server/0093-Optimize-noise-generation.patch b/patches/server/0094-Optimize-noise-generation.patch similarity index 100% rename from patches/server/0093-Optimize-noise-generation.patch rename to patches/server/0094-Optimize-noise-generation.patch diff --git a/patches/server/0094-Ignore-durability-change-equipment-updates.patch b/patches/server/0095-Ignore-durability-change-equipment-updates.patch similarity index 100% rename from patches/server/0094-Ignore-durability-change-equipment-updates.patch rename to patches/server/0095-Ignore-durability-change-equipment-updates.patch diff --git a/patches/server/0095-Hide-flames-on-entities-with-fire-resistance.patch b/patches/server/0096-Hide-flames-on-entities-with-fire-resistance.patch similarity index 100% rename from patches/server/0095-Hide-flames-on-entities-with-fire-resistance.patch rename to patches/server/0096-Hide-flames-on-entities-with-fire-resistance.patch diff --git a/patches/server/0096-Skip-cloning-advancement-criteria.patch b/patches/server/0097-Skip-cloning-advancement-criteria.patch similarity index 100% rename from patches/server/0096-Skip-cloning-advancement-criteria.patch rename to patches/server/0097-Skip-cloning-advancement-criteria.patch diff --git a/patches/server/0097-Reduce-block-destruction-packet-allocations.patch b/patches/server/0098-Reduce-block-destruction-packet-allocations.patch similarity index 100% rename from patches/server/0097-Reduce-block-destruction-packet-allocations.patch rename to patches/server/0098-Reduce-block-destruction-packet-allocations.patch diff --git a/patches/server/0098-Player-canSee-by-entity-UUID.patch b/patches/server/0099-Player-canSee-by-entity-UUID.patch similarity index 100% rename from patches/server/0098-Player-canSee-by-entity-UUID.patch rename to patches/server/0099-Player-canSee-by-entity-UUID.patch diff --git a/patches/server/0099-Spread-out-sending-all-player-info.patch b/patches/server/0100-Spread-out-sending-all-player-info.patch similarity index 100% rename from patches/server/0099-Spread-out-sending-all-player-info.patch rename to patches/server/0100-Spread-out-sending-all-player-info.patch diff --git a/patches/server/0100-Optimize-player-list-for-sending-player-info.patch b/patches/server/0101-Optimize-player-list-for-sending-player-info.patch similarity index 100% rename from patches/server/0100-Optimize-player-list-for-sending-player-info.patch rename to patches/server/0101-Optimize-player-list-for-sending-player-info.patch diff --git a/patches/server/0101-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch b/patches/server/0102-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch similarity index 100% rename from patches/server/0101-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch rename to patches/server/0102-Skip-PlayerCommandSendEvent-if-there-are-no-listener.patch diff --git a/patches/server/0102-Send-multiple-keep-alive-packets.patch b/patches/server/0103-Send-multiple-keep-alive-packets.patch similarity index 100% rename from patches/server/0102-Send-multiple-keep-alive-packets.patch rename to patches/server/0103-Send-multiple-keep-alive-packets.patch diff --git a/patches/server/0103-Prevent-entities-random-strolling-into-non-ticking-c.patch b/patches/server/0104-Prevent-entities-random-strolling-into-non-ticking-c.patch similarity index 100% rename from patches/server/0103-Prevent-entities-random-strolling-into-non-ticking-c.patch rename to patches/server/0104-Prevent-entities-random-strolling-into-non-ticking-c.patch diff --git a/patches/server/0104-Specific-interval-TPS-API.patch b/patches/server/0105-Specific-interval-TPS-API.patch similarity index 100% rename from patches/server/0104-Specific-interval-TPS-API.patch rename to patches/server/0105-Specific-interval-TPS-API.patch diff --git a/patches/server/0105-5-second-TPS-average.patch b/patches/server/0106-5-second-TPS-average.patch similarity index 100% rename from patches/server/0105-5-second-TPS-average.patch rename to patches/server/0106-5-second-TPS-average.patch diff --git a/patches/server/0106-Measure-last-tick-time.patch b/patches/server/0107-Measure-last-tick-time.patch similarity index 100% rename from patches/server/0106-Measure-last-tick-time.patch rename to patches/server/0107-Measure-last-tick-time.patch diff --git a/patches/server/0107-Last-tick-time-API.patch b/patches/server/0108-Last-tick-time-API.patch similarity index 100% rename from patches/server/0107-Last-tick-time-API.patch rename to patches/server/0108-Last-tick-time-API.patch diff --git a/patches/server/0108-Show-last-tick-time-in-tps-command.patch b/patches/server/0109-Show-last-tick-time-in-tps-command.patch similarity index 100% rename from patches/server/0108-Show-last-tick-time-in-tps-command.patch rename to patches/server/0109-Show-last-tick-time-in-tps-command.patch diff --git a/patches/server/0109-Increase-time-statistics-in-intervals.patch b/patches/server/0110-Increase-time-statistics-in-intervals.patch similarity index 100% rename from patches/server/0109-Increase-time-statistics-in-intervals.patch rename to patches/server/0110-Increase-time-statistics-in-intervals.patch diff --git a/patches/server/0110-For-collision-check-has-physics-before-same-vehicle.patch b/patches/server/0111-For-collision-check-has-physics-before-same-vehicle.patch similarity index 100% rename from patches/server/0110-For-collision-check-has-physics-before-same-vehicle.patch rename to patches/server/0111-For-collision-check-has-physics-before-same-vehicle.patch diff --git a/patches/server/0111-Skip-negligible-planar-movement-multiplication.patch b/patches/server/0112-Skip-negligible-planar-movement-multiplication.patch similarity index 100% rename from patches/server/0111-Skip-negligible-planar-movement-multiplication.patch rename to patches/server/0112-Skip-negligible-planar-movement-multiplication.patch diff --git a/patches/server/0112-Reduce-RandomSource-instances.patch b/patches/server/0113-Reduce-RandomSource-instances.patch similarity index 100% rename from patches/server/0112-Reduce-RandomSource-instances.patch rename to patches/server/0113-Reduce-RandomSource-instances.patch diff --git a/patches/server/0113-Server-thread-priority-environment-variable.patch b/patches/server/0114-Server-thread-priority-environment-variable.patch similarity index 100% rename from patches/server/0113-Server-thread-priority-environment-variable.patch rename to patches/server/0114-Server-thread-priority-environment-variable.patch diff --git a/patches/server/0114-Thread-safety-annotations.patch b/patches/server/0115-Thread-safety-annotations.patch similarity index 100% rename from patches/server/0114-Thread-safety-annotations.patch rename to patches/server/0115-Thread-safety-annotations.patch diff --git a/patches/server/0115-CPU-cores-estimation.patch b/patches/server/0116-CPU-cores-estimation.patch similarity index 100% rename from patches/server/0115-CPU-cores-estimation.patch rename to patches/server/0116-CPU-cores-estimation.patch diff --git a/patches/server/0116-Mutex-utility.patch b/patches/server/0117-Mutex-utility.patch similarity index 100% rename from patches/server/0116-Mutex-utility.patch rename to patches/server/0117-Mutex-utility.patch diff --git a/patches/server/0117-Paired-lock-and-condition-utility.patch b/patches/server/0118-Paired-lock-and-condition-utility.patch similarity index 100% rename from patches/server/0117-Paired-lock-and-condition-utility.patch rename to patches/server/0118-Paired-lock-and-condition-utility.patch diff --git a/patches/server/0118-Unterminable-executor-utility.patch b/patches/server/0119-Unterminable-executor-utility.patch similarity index 100% rename from patches/server/0118-Unterminable-executor-utility.patch rename to patches/server/0119-Unterminable-executor-utility.patch diff --git a/patches/server/0119-FIFO-concurrent-queue-utility.patch b/patches/server/0120-FIFO-concurrent-queue-utility.patch similarity index 100% rename from patches/server/0119-FIFO-concurrent-queue-utility.patch rename to patches/server/0120-FIFO-concurrent-queue-utility.patch diff --git a/patches/server/0120-Base-thread-pools.patch b/patches/server/0121-Base-thread-pools.patch similarity index 100% rename from patches/server/0120-Base-thread-pools.patch rename to patches/server/0121-Base-thread-pools.patch diff --git a/patches/server/0121-Non-blocking-PooledObjects.patch b/patches/server/0122-Non-blocking-PooledObjects.patch similarity index 100% rename from patches/server/0121-Non-blocking-PooledObjects.patch rename to patches/server/0122-Non-blocking-PooledObjects.patch