How to make an item auto repair?

Discussion in 'Plugin Development' started by winitro, Sep 13, 2014.

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

    winitro

    What I tried?
    Code:
                Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
     
                    @Override
                    public void run() {
                        if(LO.getDurability() != 0){
                            LO.setDurability((short) 0);
                        }
                       
                    }
                   
                }, 0, 1);
     
  2. Offline

    stoneminer02

    If you want the item to get autorepaired on time, do a scheduler.
    Else do a while true to set the item they are holding, if it is a pickaxe for example, repair it.
    Remember to not overwrite it because of it can be an enchanted one.
     
  3. winitro You should make it so when they break a block or when it gets to a certain durability change it rather than doing a task which could cause lag with lots of players.
     
  4. Offline

    4thegame3

    i think that setting the durability to -1 you make it indestructible. im not sure.
     
Thread Status:
Not open for further replies.

Share This Page