Skip to content

Commit

Permalink
Fix stats event call
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytv committed Dec 17, 2024
1 parent 9722666 commit c55ad70
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
--- a/net/minecraft/stats/StatsCounter.java
+++ b/net/minecraft/stats/StatsCounter.java
@@ -18,6 +_,12 @@
}
@@ -14,6 +_,12 @@

public void setValue(Player player, Stat<?> stat, int value) {
public void increment(Player player, Stat<?> stat, int amount) {
int i = (int)Math.min((long)this.getValue(stat) + amount, 2147483647L);
+ // CraftBukkit start - fire Statistic events
+ org.bukkit.event.Cancellable cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.handleStatisticsIncrease(player, stat, this.getValue(stat), value);
+ org.bukkit.event.Cancellable cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.handleStatisticsIncrease(player, stat, this.getValue(stat), i);
+ if (cancellable != null && cancellable.isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
this.stats.put(stat, value);
this.setValue(player, stat, i);
}

0 comments on commit c55ad70

Please sign in to comment.