From 708d52ca0393267f706ce612a8356a2e21f69b70 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 16 Jun 2018 16:30:29 -0400 Subject: [PATCH] Ignore Missing Recipes in RecipeBook to avoid data errors This code was causing NPE's in saving player data, potentially related to reloads. --- ...-shield-blocking-delay-configurable.patch} | 4 +- ...ecipes-in-RecipeBook-to-avoid-data-e.patch | 43 +++++++++++++++++++ scripts/importmcdev.sh | 1 + 3 files changed, 46 insertions(+), 2 deletions(-) rename Spigot-API-Patches/{0112-Make-shield-blocking-delay-configurable.patch => 0113-Make-shield-blocking-delay-configurable.patch} (93%) create mode 100644 Spigot-Server-Patches/0310-Ignore-Missing-Recipes-in-RecipeBook-to-avoid-data-e.patch diff --git a/Spigot-API-Patches/0112-Make-shield-blocking-delay-configurable.patch b/Spigot-API-Patches/0113-Make-shield-blocking-delay-configurable.patch similarity index 93% rename from Spigot-API-Patches/0112-Make-shield-blocking-delay-configurable.patch rename to Spigot-API-Patches/0113-Make-shield-blocking-delay-configurable.patch index 963a3aaac..2f40d0232 100644 --- a/Spigot-API-Patches/0112-Make-shield-blocking-delay-configurable.patch +++ b/Spigot-API-Patches/0113-Make-shield-blocking-delay-configurable.patch @@ -1,4 +1,4 @@ -From 26b6ff3f923bd7ff541cfc78312596986fdee0c1 Mon Sep 17 00:00:00 2001 +From a6ab787c5dd9cc0681087bfb35ae3b837dc4683a Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Sat, 16 Jun 2018 01:17:39 -0500 Subject: [PATCH] Make shield blocking delay configurable @@ -29,5 +29,5 @@ index 42cf95e1..5921c952 100644 // Paper end } -- -2.11.0 +2.17.1 diff --git a/Spigot-Server-Patches/0310-Ignore-Missing-Recipes-in-RecipeBook-to-avoid-data-e.patch b/Spigot-Server-Patches/0310-Ignore-Missing-Recipes-in-RecipeBook-to-avoid-data-e.patch new file mode 100644 index 000000000..bb4c5bb09 --- /dev/null +++ b/Spigot-Server-Patches/0310-Ignore-Missing-Recipes-in-RecipeBook-to-avoid-data-e.patch @@ -0,0 +1,43 @@ +From 4d65cc39ce63e647fa1d79567a7b44c5666b8fca Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sat, 16 Jun 2018 16:23:38 -0400 +Subject: [PATCH] Ignore Missing Recipes in RecipeBook to avoid data errors + +This code was causing NPE's in saving player data, potentially related to reloads. + +diff --git a/src/main/java/net/minecraft/server/RecipeBookServer.java b/src/main/java/net/minecraft/server/RecipeBookServer.java +index 7eecdc9da..c7b947d2f 100644 +--- a/src/main/java/net/minecraft/server/RecipeBookServer.java ++++ b/src/main/java/net/minecraft/server/RecipeBookServer.java +@@ -63,7 +63,11 @@ public class RecipeBookServer extends RecipeBook { + while (iterator.hasNext()) { + IRecipe irecipe = (IRecipe) iterator.next(); + +- nbttaglist.add(new NBTTagString(((MinecraftKey) CraftingManager.recipes.b(irecipe)).toString())); ++ // Paper start - ignore missing recipes ++ MinecraftKey key = CraftingManager.recipes.b(irecipe); ++ if (key == null) continue; ++ nbttaglist.add(new NBTTagString(key.toString())); ++ // Paper end + } + + nbttagcompound.set("recipes", nbttaglist); +@@ -71,9 +75,13 @@ public class RecipeBookServer extends RecipeBook { + Iterator iterator1 = this.e().iterator(); + + while (iterator1.hasNext()) { +- IRecipe irecipe1 = (IRecipe) iterator1.next(); ++ // Paper start - ignore missing recipes ++ IRecipe irecipe = (IRecipe) iterator1.next(); + +- nbttaglist1.add(new NBTTagString(((MinecraftKey) CraftingManager.recipes.b(irecipe1)).toString())); ++ MinecraftKey key = CraftingManager.recipes.b(irecipe); ++ if (key == null) continue; ++ nbttaglist.add(new NBTTagString(key.toString())); ++ // Paper end + } + + nbttagcompound.set("toBeDisplayed", nbttaglist1); +-- +2.17.1 + diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index 3094773bb..089e2cded 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -101,6 +101,7 @@ import PlayerConnectionUtils import RegionFile import RegistryBlockID import RemoteControlListener +import RecipeBookServer import ServerPing import StructureBoundingBox import StructurePiece