Implement PlayerRecipeDiscoverEvent and methods to (un/)discover recipes

By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
CraftBukkit/Spigot
2018-09-29 19:24:51 -04:00
parent d5f782996e
commit 30980b852c
3 changed files with 67 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
--- a/net/minecraft/server/RecipeBookServer.java
+++ b/net/minecraft/server/RecipeBookServer.java
@@ -8,6 +8,7 @@
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class RecipeBookServer extends RecipeBook {
@@ -27,7 +28,7 @@
IRecipe irecipe = (IRecipe) iterator.next();
MinecraftKey minecraftkey = irecipe.getKey();
- if (!this.a.contains(minecraftkey) && !irecipe.c()) {
+ if (!this.a.contains(minecraftkey) && !irecipe.c() && CraftEventFactory.handlePlayerRecipeListUpdateEvent(entityplayer, minecraftkey)) { // CraftBukkit
this.a(minecraftkey);
this.c(minecraftkey);
arraylist.add(minecraftkey);