9
0
mirror of https://github.com/SparklyPower/SparklyPaper.git synced 2025-12-19 15:09:27 +00:00
Files
SparklyPaperMC/sparklypaper-server/minecraft-patches/features/0004-Skip-dirty-stats-copy-when-requesting-player-stats.patch
2025-01-14 00:53:10 -03:00

41 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrPowerGamerBR <git@mrpowergamerbr.com>
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<Stat<?>> getDirty() {
Set<Stat<?>> 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<Stat<?>> 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));
}
}