From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MrPowerGamerBR Date: Mon, 13 Jan 2025 14:32:08 -0300 Subject: [PATCH] Skip dirty stats copy when requesting player stats diff --git a/net/minecraft/stats/ServerStatsCounter.java b/net/minecraft/stats/ServerStatsCounter.java index 6c5205fe1dc6387a77b1edbdcab748d39e775d7f..c6e4a7668ed923d93bd7f67d19af82d5d84a0dc0 100644 --- a/net/minecraft/stats/ServerStatsCounter.java +++ b/net/minecraft/stats/ServerStatsCounter.java @@ -81,11 +81,15 @@ public class ServerStatsCounter extends StatsCounter { this.dirty.add(stat); } + // SparklyPaper start - Skip dirty stats copy when requesting player stats + /* private Set> getDirty() { Set> set = Sets.newHashSet(this.dirty); this.dirty.clear(); return set; } + */ + // SparklyPaper end public void parseLocal(DataFixer fixerUpper, String json) { try { @@ -190,10 +194,12 @@ public class ServerStatsCounter extends StatsCounter { public void sendStats(ServerPlayer player) { Object2IntMap> map = new Object2IntOpenHashMap<>(); - for (Stat stat : this.getDirty()) { + for (Stat stat : this.dirty) { // SparklyPaper - Skip dirty stats copy when requesting player stats map.put(stat, this.getValue(stat)); } + this.dirty.clear(); // SparklyPaper - Skip dirty stats copy when requesting player stats + player.connection.send(new ClientboundAwardStatsPacket(map)); } }