summaryrefslogtreecommitdiffstats
path: root/nms-patches/RecipeBookServer.patch
blob: 821331746d70f3339cb87038760fceec26c31226 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--- 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);
@@ -61,6 +62,7 @@
     }
 
     private void a(PacketPlayOutRecipes.Action packetplayoutrecipes_action, EntityPlayer entityplayer, List<MinecraftKey> list) {
+        if (entityplayer.playerConnection == null) return; // SPIGOT-4478 during PlayerLoginEvent
         entityplayer.playerConnection.sendPacket(new PacketPlayOutRecipes(packetplayoutrecipes_action, list, Collections.emptyList(), this.c, this.d, this.e, this.f));
     }