aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/stats/StatsCounter.java.patch
blob: b35df579f8201f1176402c847310a4f3cdbe00a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--- a/net/minecraft/stats/StatsCounter.java
+++ b/net/minecraft/stats/StatsCounter.java
@@ -13,8 +14,15 @@
     }
 
     public void increment(Player player, Stat<?> stat, int amount) {
-        int i = (int)Math.min((long)this.getValue(stat) + (long)amount, 2147483647L);
-        this.setValue(player, stat, i);
+        int j = (int) Math.min((long) this.getValue(stat) + (long) amount, 2147483647L);
+
+        // CraftBukkit start - fire Statistic events
+        org.bukkit.event.Cancellable cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.handleStatisticsIncrease(player, stat, this.getValue(stat), j);
+        if (cancellable != null && cancellable.isCancelled()) {
+            return;
+        }
+        // CraftBukkit end
+        this.setValue(player, stat, j);
     }
 
     public void setValue(Player player, Stat<?> stat, int value) {