pocketmine\event\entity\EntityArmorChangeEvent::getNewItem PHP Method

getNewItem() public method

public getNewItem ( )
    public function getNewItem()
    {
        return $this->newItem;
    }

Usage Example

 public function clear($index, $source = null)
 {
     if (isset($this->slots[$index])) {
         $item = Item::get(Item::AIR, null, 0);
         $old = $this->slots[$index];
         if ($index >= $this->getSize() and $index < $this->size) {
             //Armor change
             Server::getInstance()->getPluginManager()->callEvent($ev = new EntityArmorChangeEvent($this->getHolder(), $old, $item, $index));
             if ($ev->isCancelled()) {
                 $this->sendArmorContents($this->getViewers());
                 $this->sendContents($this->getViewers());
                 return;
             }
             $item = $ev->getNewItem();
         }
         if ($item->getID() !== Item::AIR) {
             $this->slots[$index] = clone $item;
         } else {
             unset($this->slots[$index]);
         }
         $this->onSlotChange($index, $old, $source);
     }
 }
All Usage Examples Of pocketmine\event\entity\EntityArmorChangeEvent::getNewItem