2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/stats/RecipeBookServer.java
|
|
|
|
+++ b/net/minecraft/stats/RecipeBookServer.java
|
|
|
|
@@ -20,6 +20,8 @@
|
2018-09-30 01:24:51 +02:00
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
|
|
import org.apache.logging.log4j.Logger;
|
|
|
|
|
2021-03-08 22:47:33 +01:00
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
|
|
|
+
|
2018-09-30 01:24:51 +02:00
|
|
|
public class RecipeBookServer extends RecipeBook {
|
|
|
|
|
2021-06-11 07:00:00 +02:00
|
|
|
public static final String RECIPE_BOOK_TAG = "recipeBook";
|
|
|
|
@@ -36,7 +38,7 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
IRecipe<?> irecipe = (IRecipe) iterator.next();
|
2021-11-21 23:00:00 +01:00
|
|
|
MinecraftKey minecraftkey = irecipe.getId();
|
2018-09-30 01:24:51 +02:00
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
- if (!this.known.contains(minecraftkey) && !irecipe.isSpecial()) {
|
|
|
|
+ if (!this.known.contains(minecraftkey) && !irecipe.isSpecial() && CraftEventFactory.handlePlayerRecipeListUpdateEvent(entityplayer, minecraftkey)) { // CraftBukkit
|
|
|
|
this.add(minecraftkey);
|
|
|
|
this.addHighlight(minecraftkey);
|
2018-12-25 22:00:00 +01:00
|
|
|
list.add(minecraftkey);
|
2021-06-11 07:00:00 +02:00
|
|
|
@@ -70,6 +72,7 @@
|
2018-11-10 10:30:58 +01:00
|
|
|
}
|
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
private void sendRecipes(PacketPlayOutRecipes.Action packetplayoutrecipes_action, EntityPlayer entityplayer, List<MinecraftKey> list) {
|
2021-06-11 07:00:00 +02:00
|
|
|
+ if (entityplayer.connection == null) return; // SPIGOT-4478 during PlayerLoginEvent
|
2021-11-21 23:00:00 +01:00
|
|
|
entityplayer.connection.send(new PacketPlayOutRecipes(packetplayoutrecipes_action, list, Collections.emptyList(), this.getBookSettings()));
|
2018-11-10 10:30:58 +01:00
|
|
|
}
|
|
|
|
|