aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/stats
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/stats')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/stats/ServerRecipeBook.java.patch36
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/stats/ServerStatsCounter.java.patch1
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/stats/StatsCounter.java.patch20
3 files changed, 57 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/stats/ServerRecipeBook.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/stats/ServerRecipeBook.java.patch
new file mode 100644
index 0000000000..9be367b6e9
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/stats/ServerRecipeBook.java.patch
@@ -0,0 +1,36 @@
+--- a/net/minecraft/stats/ServerRecipeBook.java
++++ b/net/minecraft/stats/ServerRecipeBook.java
+@@ -19,6 +20,8 @@
+ import net.minecraft.world.item.crafting.RecipeManager;
+ import org.slf4j.Logger;
+
++import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
++
+ public class ServerRecipeBook extends RecipeBook {
+ public static final String RECIPE_BOOK_TAG = "recipeBook";
+ private static final Logger LOGGER = LogUtils.getLogger();
+@@ -27,14 +34,16 @@
+ List<ResourceLocation> list = Lists.newArrayList();
+ int i = 0;
+
+- for (RecipeHolder<?> recipeHolder : recipes) {
+- ResourceLocation resourceLocation = recipeHolder.id();
+- if (!this.known.contains(resourceLocation) && !recipeHolder.value().isSpecial()) {
+- this.add(resourceLocation);
+- this.addHighlight(resourceLocation);
+- list.add(resourceLocation);
+- CriteriaTriggers.RECIPE_UNLOCKED.trigger(player, recipeHolder);
+- i++;
++ while (iterator.hasNext()) {
++ RecipeHolder<?> recipeholder = (RecipeHolder) iterator.next();
++ ResourceLocation minecraftkey = recipeholder.id();
++
++ if (!this.known.contains(minecraftkey) && !recipeholder.value().isSpecial() && CraftEventFactory.handlePlayerRecipeListUpdateEvent(player, minecraftkey)) { // CraftBukkit
++ this.add(minecraftkey);
++ this.addHighlight(minecraftkey);
++ list.add(minecraftkey);
++ CriteriaTriggers.RECIPE_UNLOCKED.trigger(player, recipeholder);
++ ++i;
+ }
+ }
+
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/stats/ServerStatsCounter.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/stats/ServerStatsCounter.java.patch
new file mode 100644
index 0000000000..8b13789179
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/stats/ServerStatsCounter.java.patch
@@ -0,0 +1 @@
+
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/stats/StatsCounter.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/stats/StatsCounter.java.patch
new file mode 100644
index 0000000000..b35df579f8
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/stats/StatsCounter.java.patch
@@ -0,0 +1,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) {