CatServer icon indicating copy to clipboard operation
CatServer copied to clipboard

[1.16.5] NoSuchElementException when looping over Bukkit.recipeIterator()

Open mfnalex opened this issue 2 years ago • 2 comments

Using Bukkit's recipe iterator, it throws the following error when simply looping over the iterator:

[20:23:09] [Server thread/ERROR]: Error occurred while enabling AngelChest v9.4.0 (Is it up to date?)
 java.util.NoSuchElementException: null
        at java.util.HashMap$HashIterator.nextNode(HashMap.java:1471) ~[?:1.8.0_333]
        at java.util.HashMap$ValueIterator.next(HashMap.java:1498) ~[?:1.8.0_333]
        at org.bukkit.craftbukkit.v1_16_R3.inventory.RecipeIterator.next(RecipeIterator.java:31) ~[forge:?]
        at org.bukkit.craftbukkit.v1_16_R3.inventory.RecipeIterator.next(RecipeIterator.java:12) ~[forge:?]
        at de.jeff_media.angelchest.jC.<init>(lt:360) ~[?:?] <-- See below java code
        ...

To reproduce (the marked line is the line that throws the above error):

        Iterator<Recipe> iterator = Bukkit.recipeIterator();
        while(iterator.hasNext()) { // <-- This is the marked line from the above stacktrace
            // Do something...

This probably only happens when using blocks / items added by forge mods.

Suggested fix: Make the RecipeIterator only return recipes that contain blocks / items recognizable by Bukkit's Material class.

mfnalex avatar Aug 03 '22 13:08 mfnalex

Thanks for your submission, we will fix it asap

Kotori0629 avatar Aug 04 '22 06:08 Kotori0629

这个修复了么?

Baikele avatar Aug 07 '22 07:08 Baikele