2020-05-06 17:48:49 +08:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2017-12-10 01:42:11 +08:00
From: Aikar <aikar@aikar.co>
Date: Sat, 9 Dec 2017 12:40:25 -0500
Subject: [PATCH] Display warning on deprecated recipe API
Any plugin still using this API will result in the server saving an inconsistent UUID to player data files,
which then triggers warnings such as "Tried to load unrecognized recipe: bukkit:9e5b92f5-e549-4f47-b0a8-9f89390ed77b removed now."
on the players login.
Plugin authors need to define a key to keep it consistent between server restarts.
diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
2020-05-06 17:48:49 +08:00
index d74b3114f535e1e5e36ae007f1fe0522916a0362..d742c4058ba9aed4fbe1591fd755a06608b06e98 100644
2017-12-10 01:42:11 +08:00
--- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
2019-05-06 10:58:04 +08:00
@@ -25,6 +25,7 @@ public class ShapedRecipe implements Recipe, Keyed {
2019-03-20 08:28:15 +08:00
public ShapedRecipe(@NotNull ItemStack result) {
2019-05-06 10:58:04 +08:00
Preconditions.checkArgument(result.getType() != Material.AIR, "Recipe must have non-AIR result.");
2017-12-10 01:42:11 +08:00
this.key = NamespacedKey.randomKey();
+ new Throwable("Warning: A plugin is creating a recipe using a Deprecated method. This will cause you to receive warnings stating 'Tried to load unrecognized recipe: bukkit:<ID>'. Please ask the author to give their recipe a static key using NamespacedKey.").printStackTrace();
this.output = new ItemStack(result);
}
diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
2020-05-06 17:48:49 +08:00
index 68447fb8c12356e779b96ec98c54119045046751..84062dd719cb8a6142dc8c806777cb208c6b42b2 100644
2017-12-10 01:42:11 +08:00
--- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
2019-05-06 10:58:04 +08:00
@@ -26,6 +26,7 @@ public class ShapelessRecipe implements Recipe, Keyed {
2019-03-20 08:28:15 +08:00
public ShapelessRecipe(@NotNull ItemStack result) {
2019-05-06 10:58:04 +08:00
Preconditions.checkArgument(result.getType() != Material.AIR, "Recipe must have non-AIR result.");
2017-12-10 01:42:11 +08:00
this.key = NamespacedKey.randomKey();
+ new Throwable("Warning: A plugin is creating a recipe using a Deprecated method. This will cause you to receive warnings stating 'Tried to load unrecognized recipe: bukkit:<ID>'. Please ask the author to give their recipe a static key using NamespacedKey.").printStackTrace();
this.output = new ItemStack(result);
}