Remove dangerous RecipeUtil method.
This commit is contained in:
parent
d74690ec7c
commit
3964089955
@ -19,33 +19,6 @@ import java.util.Objects;
|
||||
// NOTE: This utility targets 1.9 and will crash on older servers.
|
||||
public class RecipeUtil
|
||||
{
|
||||
// ------------------------------------------- //
|
||||
// REMOVE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static void remove(Predicate<Recipe> removePredicate)
|
||||
{
|
||||
Objects.requireNonNull(removePredicate);
|
||||
|
||||
List<Recipe> recipesToRemove = new MassiveList<>();
|
||||
List<Recipe> recipesToKeep = new MassiveList<>();
|
||||
|
||||
Iterator<Recipe> iterator = Bukkit.recipeIterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Recipe recipe = iterator.next();
|
||||
List<Recipe> recipes = removePredicate.apply(recipe) ? recipesToRemove : recipesToKeep;
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
if (recipesToRemove.isEmpty()) return;
|
||||
|
||||
Bukkit.clearRecipes();
|
||||
for (Recipe recipe : recipesToKeep) {
|
||||
Bukkit.addRecipe(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------- //
|
||||
// POTION
|
||||
// -------------------------------------------- //
|
||||
|
Loading…
Reference in New Issue
Block a user