From 2a20e182b0a9536a083fb85633e66648cfcbeef0 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sun, 2 Feb 2020 10:32:47 +1100 Subject: [PATCH] #467: Add method to remove a recipe by its key By: ShaneBee --- paper-api/src/main/java/org/bukkit/Bukkit.java | 14 ++++++++++++++ paper-api/src/main/java/org/bukkit/Server.java | 12 ++++++++++++ 2 files changed, 26 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/Bukkit.java b/paper-api/src/main/java/org/bukkit/Bukkit.java index 4eecd55546..f43b0f0d58 100644 --- a/paper-api/src/main/java/org/bukkit/Bukkit.java +++ b/paper-api/src/main/java/org/bukkit/Bukkit.java @@ -674,6 +674,20 @@ public final class Bukkit { server.resetRecipes(); } + /** + * Remove a recipe from the server. + * + * Note that removing a recipe may cause permanent loss of data + * associated with that recipe (eg whether it has been discovered by + * players). + * + * @param key NamespacedKey of recipe to remove. + * @return True if recipe was removed + */ + public static boolean removeRecipe(@NotNull NamespacedKey key) { + return server.removeRecipe(key); + } + /** * Gets a list of command aliases defined in the server properties. * diff --git a/paper-api/src/main/java/org/bukkit/Server.java b/paper-api/src/main/java/org/bukkit/Server.java index 7a03e93eb5..4990606659 100644 --- a/paper-api/src/main/java/org/bukkit/Server.java +++ b/paper-api/src/main/java/org/bukkit/Server.java @@ -559,6 +559,18 @@ public interface Server extends PluginMessageRecipient { */ public void resetRecipes(); + /** + * Remove a recipe from the server. + * + * Note that removing a recipe may cause permanent loss of data + * associated with that recipe (eg whether it has been discovered by + * players). + * + * @param key NamespacedKey of recipe to remove. + * @return True if recipe was removed + */ + public boolean removeRecipe(@NotNull NamespacedKey key); + /** * Gets a list of command aliases defined in the server properties. *