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.
This commit is contained in:
Aikar 2017-12-09 12:40:25 -05:00
parent 5de53af38b
commit 332152c40d
2 changed files with 2 additions and 0 deletions

View file

@ -31,6 +31,7 @@ public class ShapedRecipe extends CraftingRecipe {
@Deprecated(since = "1.12")
public ShapedRecipe(@NotNull ItemStack result) {
this(NamespacedKey.randomKey(), result);
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(); // Paper
}
/**

View file

@ -20,6 +20,7 @@ public class ShapelessRecipe extends CraftingRecipe {
@Deprecated(since = "1.12")
public ShapelessRecipe(@NotNull ItemStack result) {
this(NamespacedKey.randomKey(), result);
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(); // Paper
}
/**