Created
December 1, 2013 21:10
-
-
Save russjr08/7740832 to your computer and use it in GitHub Desktop.
Disable Recipes (CraftBukkit)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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