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

Solved Armor Value help!

Discussion in 'Development' started by A354-PH, Mar 4, 2019.

  1. A354-PH

    A354-PH Baby Zombie

    Messages:
    186
    GitHub:
    Kizu
    How to fix this?
    Code:
    [10:13:56] [Server thread/CRITICAL]: Error: "Call to undefined method pocketmine\item\DiamondLeggings::getArmorValue()" (EXCEPTION) in "plugins/AutoArmor v1.1.0.phar/src/AutoArmor/Main" at line 30
    Code:
    PHP:
    public function onTap(Tap $event){
            
    $item $event->getItem();
            
    $player $event->getPlayer();
            
    $helmet $player->getArmorInventory()->getHelmet();
            
    $chestplate $player->getArmorInventory()->getChestplate();
            
    $leggings $player->getArmorInventory()->getLeggings();
            
    $boots $player->getArmorInventory()->getBoots();
            if(
    $item instanceof Armor){
                
    $at $item->getArmorValue(); //line 30
                
    $inv $player->getArmorInventory();
                
    $ht $inv->getHelmet()->getArmorValue();
                
    $ct $inv->getChestplate()->getArmorValue();
                
    $lt $inv->getLeggings()->getArmorValue();
                
    $bt $inv->getBoots()->getArmorValue();
                
    $type $item->getArmorType();
     
  2. A354-PH

    A354-PH Baby Zombie

    Messages:
    186
    GitHub:
    Kizu
    Bump
     
  3. SavionLegendZzz

    SavionLegendZzz Slime

    Messages:
    75
    GitHub:
    savionlegends
    it tells you all right there, getArmorValue() isnt a method for pocketmine\item\Armor.
     
    Muqsit and A354-PH like this.
  4. A354-PH

    A354-PH Baby Zombie

    Messages:
    186
    GitHub:
    Kizu
    So how do I fix it? Remove getArmorValue() cause it doesnt exists anymore?
     
  5. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    That exists in a few spoons, rename it to getDefensePoints
     
    A354-PH likes this.
  6. A354-PH

    A354-PH Baby Zombie

    Messages:
    186
    GitHub:
    Kizu
    Ok
     
  7. A354-PH

    A354-PH Baby Zombie

    Messages:
    186
    GitHub:
    Kizu
    Now it gives me this error
    Code:
    [11:41:07] [Server thread/CRITICAL]: Error: "Call to undefined method pocketmine\item\GoldBoots::getArmorType()" (EXCEPTION) in "plugins/AutoArmor v1.2.0.phar/src/AutoArmor/Main" at line 32
    Heres the code:
    PHP:
    $type $item->getArmorType();
     
  8. SavionLegendZzz

    SavionLegendZzz Slime

    Messages:
    75
    GitHub:
    savionlegends
     
  9. A354-PH

    A354-PH Baby Zombie

    Messages:
    186
    GitHub:
    Kizu
    Self-Solved.
     
  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.