Solved Disable the repair of an item via a craft table

Discussion in 'Spigot Plugin Development' started by Soolz, Jul 13, 2018.

Thread Status:
Not open for further replies.
  1. Hello,
    I'v tried a lot... but I can't... :confused:
     
  2. Praya

    Benefactor

    call PrepareItemCraftEvent
    check if event.isRepair() and then remove the result
     
    • Like Like x 1
  3. Yes, but how can I get the resulted item
     
  4. You mean something like this?
    Code (Text):
    ItemStack result = event.getRecipe().getResult();
    // Edit it could also be what @Praya wrote
     
    • Like Like x 1
  5. Praya

    Benefactor


    event.getInventory().setResult(result);
     
    • Like Like x 1
  6. Don't work...
    Code (Java):
    @EventHandler
            public void Topaze(PrepareItemCraftEvent e) {
                ItemStack result = e.getRecipe().getResult();
                if(e.isRepair()){
                    result.setType(Material.AIR);
                }
            }
     
  7. Praya

    Benefactor

    use event.getInventory().setResult(result);
     
    • Winner Winner x 1
  8. Thank you, I'm so stupid, sorry for not having read your message
     
Thread Status:
Not open for further replies.