PaperMC/paper-server/patches/sources/net/minecraft/stats/StatsCounter.java.patch

16 lines
576 B
Diff
Raw Normal View History

--- a/net/minecraft/stats/StatsCounter.java
+++ b/net/minecraft/stats/StatsCounter.java
2024-12-14 22:29:32 +01:00
@@ -18,6 +_,12 @@
}
2024-12-14 22:29:32 +01:00
public void setValue(Player player, Stat<?> stat, int value) {
+ // CraftBukkit start - fire Statistic events
2024-12-14 22:29:32 +01:00
+ org.bukkit.event.Cancellable cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.handleStatisticsIncrease(player, stat, this.getValue(stat), value);
+ if (cancellable != null && cancellable.isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
2024-12-14 22:29:32 +01:00
this.stats.put(stat, value);
}