From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MrPowerGamerBR Date: Mon, 13 Jan 2025 14:32:08 -0300 Subject: [PATCH] SparklyPaper: Skip dirty stats copy when requesting player stats diff --git a/net/minecraft/stats/ServerStatsCounter.java b/net/minecraft/stats/ServerStatsCounter.java index dfaead7716ac718bcdbf4c3021aed1b57676af50..d04de9dc0a9a47e6c17f1000844bdee49e41035f 100644 --- a/net/minecraft/stats/ServerStatsCounter.java +++ b/net/minecraft/stats/ServerStatsCounter.java @@ -100,11 +100,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 { @@ -146,10 +150,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)); } }