onSlotChange() публичный Метод

public onSlotChange ( $index, $before, $send )
Пример #1
0
 public function onSlotChange($index, $before, $source = null)
 {
     parent::onSlotChange($index, $before, $source);
     if ($index >= $this->getSize()) {
         $this->sendArmorContents($this->getHolder()->getViewers());
     }
 }
 public function onSlotChange($index, $before)
 {
     $holder = $this->getHolder();
     if (!$holder instanceof Player or !$holder->spawned) {
         return;
     }
     parent::onSlotChange($index, $before);
     if ($index >= $this->getSize()) {
         $this->sendArmorSlot($index, $this->getViewers());
         $this->sendArmorSlot($index, $this->getHolder()->getViewers());
     } else {
         if (!$holder->getServer()->limitedCreative or $holder->isSurvival()) {
             $this->sendContents($holder);
         }
     }
 }
 public function onSlotChange($index, $before)
 {
     $holder = $this->getHolder();
     if ($holder instanceof Player and !$holder->spawned) {
         return;
     }
     parent::onSlotChange($index, $before);
     if ($index >= $this->getSize()) {
         $this->sendArmorSlot($index, $this->getViewers());
         $this->sendArmorSlot($index, $this->getHolder()->getViewers());
     }
 }
Пример #4
0
 public function onSlotChange($index, $before, $send)
 {
     if ($send) {
         $holder = $this->getHolder();
         if (!$holder instanceof Player or !$holder->spawned) {
             return;
         }
         parent::onSlotChange($index, $before, $send);
     }
     if ($index === $this->itemInHandIndex) {
         $this->sendHeldItem($this->getHolder()->getViewers());
         if ($send) {
             $this->sendHeldItem($this->getHolder());
         }
     } elseif ($index >= $this->getSize()) {
         //Armour equipment
         $this->sendArmorSlot($index, $this->getViewers());
         $this->sendArmorSlot($index, $this->getHolder()->getViewers());
     }
 }