Skip to content
Permalink
Browse files
Fix error for remove_recipe() on Spigot versions earlier than 1.15.2
  • Loading branch information
PseudoKnight committed May 19, 2020
1 parent 71e7ca2 commit bd424bfcee9bff0be81b5a0461f1d6918cae4df7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
@@ -557,7 +557,12 @@ public boolean addRecipe(MCRecipe recipe) {

@Override
public boolean removeRecipe(String key) {
return s.removeRecipe(NamespacedKey.minecraft(key));
try {
return s.removeRecipe(NamespacedKey.minecraft(key));
} catch (NoSuchMethodError ex) {
// probably before 1.15.2
return false;
}
}

@Override
@@ -177,7 +177,8 @@ public Integer[] numArgs() {
@Override
public String docs() {
return "boolean {recipe_key} Remove a certain recipe by its registered key."
+ " Returns whether the recipe was removed successfully or not.";
+ " Returns whether the recipe was removed successfully or not."
+ " (Minecraft 1.15.2 or higher)";
}
}

0 comments on commit bd424bf

Please sign in to comment.