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

Solved if player Use Chestplate

Discussion in 'Development' started by KYUMA, Aug 13, 2017.

  1. KYUMA

    KYUMA Silverfish

    Messages:
    16
    GitHub:
    Ky75
    i need code for if player use chestplate
    =)
     
  2. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    Take a look at PlayerInventory.php
     
  3. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    693
    GitHub:
    winterbuild7074
    PHP:
    /** @var Player $player */
    $chestplateids = [303,307,311,315];
    if(
    in_array($player->getInventory()->getChestplate()->getId(), $chestplateids)) {
        
    // do something
    }
     
  4. r7vmc

    r7vmc Baby Zombie

    Messages:
    112
    GitHub:
    r7vmc
    PHP:
        if($player->getInventory()->getChestplate()->getId() === Item::DIAMOND_CHESTPLATE){
    //do stuff
    }
     
  5. KYUMA

    KYUMA Silverfish

    Messages:
    16
    GitHub:
    Ky75

    Thanks!!
     
  6. KYUMA

    KYUMA Silverfish

    Messages:
    16
    GitHub:
    Ky75
    Thanks bro =)
     
    r7vmc likes this.
  7. r7vmc

    r7vmc Baby Zombie

    Messages:
    112
    GitHub:
    r7vmc
    your welcome
     
  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.