Skip to content

Instantly share code, notes, and snippets.

@russjr08
Created December 1, 2013 21:10
Show Gist options
  • Save russjr08/7740832 to your computer and use it in GitHub Desktop.
Save russjr08/7740832 to your computer and use it in GitHub Desktop.
Disable Recipes (CraftBukkit)
/**
* Disables Recipes
* @param item The item to disable recipe for.
*/
public void disableRecipe(Material item) {
// Get Recipe Iterator
Iterator<Recipe> iterator = getServer().recipeIterator();
// Traverse the iterator and check if recipe's result is equal to item passed in.
while (iterator.hasNext()) {
ItemStack result = iterator.next().getResult();
if (result.getType() == item) {
// If item is the same as the result, remove it from the recipe list.
iterator.remove();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment