mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
42 lines
1.6 KiB
Diff
42 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] SparklyPaper: Skip dirty stats copy when requesting player
|
|
stats
|
|
|
|
|
|
diff --git a/net/minecraft/stats/ServerStatsCounter.java b/net/minecraft/stats/ServerStatsCounter.java
|
|
index 195ff539c9cb4b2a0640555fc4b59df39e06c90d..8a927cb4327f5fdfe06b595095d840e789141733 100644
|
|
--- a/net/minecraft/stats/ServerStatsCounter.java
|
|
+++ b/net/minecraft/stats/ServerStatsCounter.java
|
|
@@ -98,11 +98,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 {
|
|
@@ -141,10 +145,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));
|
|
}
|
|
}
|