Solved Disabling A Custom Recipe Without return;

Discussion in 'Plugin Development' started by SandKastle, Jul 8, 2013.

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

    SandKastle

    So i need another option besides return that could fit into he code i have. return just stops it entirely which i cant have of course so here is the code. Anything i could replace return; with to disable 1 recipe?

    Code:java
    1. {
    2. if(getConfig().getBoolean("Disable Iron Horse Armor") == true) return;
    3. ShapedRecipe iha = new ShapedRecipe(new ItemStack(417));
    4. iha.shape(new String[] { " I", "IBI", "III" });
    5. iha.setIngredient('I', Material.IRON_INGOT);
    6. iha.setIngredient('B', Material.WOOL, 15);
    7. server.addRecipe(iha);
    8. }
    9.  
    10. {
    11. if(getConfig().getBoolean("Disable Gold Horse Armor") == true) return;
    12. ShapedRecipe gha = new ShapedRecipe(new ItemStack(418));
    13. gha.shape(new String[] { " I", "IBI", "III" });
    14. gha.setIngredient('I', Material.GOLD_INGOT);
    15. gha.setIngredient('B', Material.WOOL, 14);
    16. server.addRecipe(gha);
    17. }
    18.  
    19. {
    20. if(getConfig().getBoolean("Disable Diamond Horse Armor") == true) return;
    21. ShapedRecipe dha = new ShapedRecipe(new ItemStack(419));
    22. dha.shape(new String[] { " I", "IBI", "III" });
    23. dha.setIngredient('I', Material.DIAMOND);
    24. dha.setIngredient('B', Material.WOOL, 11);
    25. server.addRecipe(dha);
    26. }
    27.  
    28. {
    29. if(getConfig().getBoolean("Disable Saddle") == true) return;
    30. ShapedRecipe saddle = new ShapedRecipe(new ItemStack(329));
    31. saddle.shape(new String[] { "III", "IBI" });
    32. saddle.setIngredient('I', Material.LEATHER);
    33. saddle.setIngredient('B', Material.IRON_INGOT);
    34. server.addRecipe(saddle);
    35. }
    36.  
    37. {
    38. if(getConfig().getBoolean("Disable Tag") == true) return;
    39. ShapedRecipe tag = new ShapedRecipe(new ItemStack(421));
    40. tag.shape(new String[] { " I", " B ", "B " });
    41. tag.setIngredient('I', Material.STRING);
    42. tag.setIngredient('B', Material.PAPER);
    43. server.addRecipe(tag);
    44. }
    45. }
     
  2. Offline

    SnipsRevival

    Change your if statements to false and place the code inside them.
     
  3. Offline

    SandKastle

    oh wow, i just realized the code wasnt inside it -,- i was wondering why it didnt work, thank you.
     
Thread Status:
Not open for further replies.

Share This Page