PaperMC/paper-server/patches/sources/net/minecraft/stats/ServerRecipeBook.java.patch
2024-12-18 19:29:39 +01:00

29 lines
1.2 KiB
Diff

--- a/net/minecraft/stats/ServerRecipeBook.java
+++ b/net/minecraft/stats/ServerRecipeBook.java
@@ -67,7 +_,7 @@
for (RecipeHolder<?> recipeHolder : recipes) {
ResourceKey<Recipe<?>> resourceKey = recipeHolder.id();
- if (!this.known.contains(resourceKey) && !recipeHolder.value().isSpecial()) {
+ if (!this.known.contains(resourceKey) && !recipeHolder.value().isSpecial() && org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerRecipeListUpdateEvent(player, resourceKey.location())) { // CraftBukkit
this.add(resourceKey);
this.addHighlight(resourceKey);
this.displayResolver
@@ -78,7 +_,7 @@
}
}
- if (!list.isEmpty()) {
+ if (!list.isEmpty() && player.connection != null) { // SPIGOT-4478 during PlayerLoginEvent
player.connection.send(new ClientboundRecipeBookAddPacket(list, false));
}
@@ -96,7 +_,7 @@
}
}
- if (!list.isEmpty()) {
+ if (!list.isEmpty() && player.connection != null) { // SPIGOT-4478 during PlayerLoginEvent
player.connection.send(new ClientboundRecipeBookRemovePacket(list));
}