craftbukkit/nms-patches/net/minecraft/stats/StatisticManager.patch

16 lines
709 B
Diff
Raw Normal View History

2021-03-16 09:00:00 +11:00
--- a/net/minecraft/stats/StatisticManager.java
+++ b/net/minecraft/stats/StatisticManager.java
@@ -16,6 +16,12 @@
2021-11-22 09:00:00 +11:00
public void increment(EntityHuman entityhuman, Statistic<?> statistic, int i) {
int j = (int) Math.min((long) this.getValue(statistic) + (long) i, 2147483647L);
2020-06-25 10:00:00 +10:00
2017-05-14 12:00:00 +10:00
+ // CraftBukkit start - fire Statistic events
2021-11-22 09:00:00 +11:00
+ org.bukkit.event.Cancellable cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.handleStatisticsIncrease(entityhuman, statistic, this.getValue(statistic), j);
2017-05-14 12:00:00 +10:00
+ if (cancellable != null && cancellable.isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
2021-11-22 09:00:00 +11:00
this.setValue(entityhuman, statistic, j);
}
2015-02-26 22:41:06 +00:00