Removing Recipes stalls the server?

Discussion in 'Plugin Development' started by russjr08, May 23, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    russjr08

    I'm trying to remove a few recipes with my plugin, and when the plugin gets to the removal process, it freezes the server.

    This is my method of removing recipes:
    Code:
    public void disableRecipes(org.bukkit.inventory.Recipe removedRecipe){
            Iterator<org.bukkit.inventory.Recipe> iterator = getServer().recipeIterator();
     
            while(iterator.hasNext()){
                org.bukkit.inventory.Recipe theRecipe = iterator.next();
                if(theRecipe.getResult() == removedRecipe.getResult()){
                    System.out.println("Removing Recipe: " + theRecipe.getResult().getType());
                    iterator.remove();
                }
            }
        }
    Does anything look like it would freeze the server?
     
  2. Offline

    Minnymin3

    Does it completely freeze the server by completely not responding for a few seconds or "completely never going to respond you killed me good job"?
     
  3. Offline

    russjr08

    It freezes forever. I let it sit there for five minutes before deciding that it wasn't coming back.

    I almost feel like there is an infinite loop somewhere..
     
  4. Offline

    Minnymin3

    Ok this kind of thing happened to me a bunch of times. Couldn't get around it so I submitted a ticket. Still not fixed... Its a problem with the way Bukkit handles recipes (or the way minecraft handles recipes)
     
  5. Offline

    russjr08

    Aww poop :( I was hoping to override a few vanilla recipes... I guess I could listen to the PreCraft event, but that seems a little messy..
     
  6. Offline

    Minnymin3

    Thats, sadly, the best way to do it.
     
  7. Offline

    russjr08

    Hmm, alright. To change a bad situation into a good one... I guess this'll allow me to easily alert users of the recipe change too. Hit two birds with one stone :)

    Hmm... any way of comparing if a recipe is the same as a custom one without checking their result?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
    Minnymin3 likes this.
  8. Offline

    Minnymin3

    Its a bad idea thats one way that I crashed my server... repeatedly... again and again trying to fix it...

    But click here if you really want to try it out.
     
Thread Status:
Not open for further replies.

Share This Page