mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
35 lines
2.4 KiB
Diff
35 lines
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
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
|
|
index e57e600283702dd7fc60fa3baa1e1cc1b8574873..7be830ea0a3b24c5cdfb8e6ab62cb2ee506a4026 100644
|
|
--- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java
|
|
+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
|
|
@@ -26,6 +26,7 @@ public class ShapedRecipe implements Recipe, Keyed {
|
|
public ShapedRecipe(@NotNull ItemStack result) {
|
|
Preconditions.checkArgument(result.getType() != Material.AIR, "Recipe must have non-AIR result.");
|
|
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
|
|
index df4c52f1f0be2409c7506b09167bd58b5602fa7a..62675962d1b7882b953d2618aed1f363c046e97d 100644
|
|
--- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
|
|
+++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
|
|
@@ -27,6 +27,7 @@ public class ShapelessRecipe implements Recipe, Keyed {
|
|
public ShapelessRecipe(@NotNull ItemStack result) {
|
|
Preconditions.checkArgument(result.getType() != Material.AIR, "Recipe must have non-AIR result.");
|
|
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);
|
|
}
|
|
|