1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Repair plugin

Discussion in 'Plugin Help' started by AsponPL, Jul 22, 2019.

  1. AsponPL

    AsponPL Spider Jockey

    Messages:
    47
    Hello, I have a problem, i don't know how i can write or do a plugin for reparing items in hand and all in inventory please help me. Thank you.


    Don't say [learn php, learn pocketmine, download a plugin from github or pmmp] because it will don't help me thanks.
     
  2. Mr174

    Mr174 Baby Zombie

    Messages:
    187
    GitHub:
    mr174
    What about this, there are plugins on pmmp that have it, take a look at their code try it out and if it doesnt work report your problems here!
    I'll help you with your issues!
     
    OnTheVerge likes this.
  3. AsponPL

    AsponPL Spider Jockey

    Messages:
    47
    Yea okey i Will try this if i have a problem i Will talk here
     
    Mr174 likes this.
  4. JackMD

    JackMD Silverfish

    Messages:
    22
    GitHub:
    jackmd
  5. AsponPL

    AsponPL Spider Jockey

    Messages:
    47
    PHP:
                                if(isset($args[0])){
                                 if(
    $args[0] == "all"){
                                  foreach(
    $sender->getInventory()->getContents() as $item)
                                  {
                                   if(
    $item instanceof Tool$item->setDamage(0);
                                   }
                                   foreach(
    $sender->getInventory()->getArmorContents() as $item)
                                   {
                                    if(
    $item instanceof Armor$item->setDamage(0);
                                    }
                                    
    $sender->sendMessage("ยง7All of your items have been repaired!");
                                    return 
    true;
                                 }
                                 return 
    true;
                                }
                                return 
    true;
                }
            }
        }
        return 
    true;
        }
    }
    it doen't work when i say /repair all

    PHP:
    Error"Call to undefined method pocketmine\inventory\PlayerInventory::getArmorContents()" (EXCEPTIONin "plugins/repair/src/repair/Main" at line 657
     
  6. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    Change
    PHP:
    getInventory()->getArmorContents()
    To
    PHP:
    getArmorInventory()->getContents()
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.