PaperMC/nms-patches/StatisticManager.patch

16 lines
725 B
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/StatisticManager.java
+++ b/net/minecraft/server/StatisticManager.java
2020-06-25 02:00:00 +02:00
@@ -15,6 +15,12 @@
2018-07-15 02:00:00 +02:00
public void b(EntityHuman entityhuman, Statistic<?> statistic, int i) {
2020-06-25 02:00:00 +02:00
int j = (int) Math.min((long) this.getStatisticValue(statistic) + (long) i, 2147483647L);
2017-05-14 04:00:00 +02:00
+ // CraftBukkit start - fire Statistic events
2020-06-25 02:00:00 +02:00
+ org.bukkit.event.Cancellable cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.handleStatisticsIncrease(entityhuman, statistic, this.getStatisticValue(statistic), j);
2017-05-14 04:00:00 +02:00
+ if (cancellable != null && cancellable.isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
2020-06-25 02:00:00 +02:00
this.setStatistic(entityhuman, statistic, j);
}
2015-02-26 23:41:06 +01:00