Inheritance: extends EntityEvent, implements pocketmine\event\Cancellable
 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);
     }
 }
 public function clear($index)
 {
     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()) {
                 if ($index >= $this->size) {
                     $this->sendArmorSlot($index, $this->getViewers());
                 } else {
                     $this->sendSlot($index, $this->getViewers());
                 }
                 return \false;
             }
             $item = $ev->getNewItem();
         } else {
             Server::getInstance()->getPluginManager()->callEvent($ev = new EntityInventoryChangeEvent($this->getHolder(), $old, $item, $index));
             if ($ev->isCancelled()) {
                 if ($index >= $this->size) {
                     $this->sendArmorSlot($index, $this->getViewers());
                 } else {
                     $this->sendSlot($index, $this->getViewers());
                 }
                 return \false;
             }
             $item = $ev->getNewItem();
         }
         if ($item->getId() !== Item::AIR) {
             $this->slots[$index] = clone $item;
         } else {
             unset($this->slots[$index]);
         }
         $this->onSlotChange($index, $old);
     }
     return \true;
 }
Beispiel #3
0
 public function onArmor(EntityArmorChangeEvent $event)
 {
     $player = $event->getEntity();
     if ($this->ghost[$player->getName()] == true) {
         $this->alert($player->getName(), "유령 주제에 어딜!");
         $this->alert($player->getName(), "악령은 썩 물럿거라 - 물외한인(MohiPE)");
         $event->setCancelled();
     }
 }
Beispiel #4
0
 public function onArmorChange(EntityArmorChangeEvent $event)
 {
     if ($event->getEntity() instanceof Player) {
         $request = "UPDATE `dynmap_players` SET `armor` = '" . $event->getEntity()->getHealth() . "' WHERE `name` = '" . $event->getEntity()->getName() . "'";
         // fix armor is heath
         if (!($result = $this->database->query($request))) {
             $this->getLogger()->notice('There was an error running the query [' . $this->database->error . ']');
         }
     }
     return;
 }
 /**
  * @param EntityArmorChangeEvent $event
  * @priority HIGHEST
  * @ignoreCancelled true
  */
 public function onEntityArmorChange(EntityArmorChangeEvent $event)
 {
     if (($player = $event->getEntity()) instanceof Player) {
         if (!$this->plugin->getStorage()->getShield($player->getLevel())->isAllowed(Shield::ARMOR_CHANGING)) {
             $event->setCancelled(true);
             $player->sendTip($this->plugin->getConfig()->get("armorChangeNotAllowed"));
         }
     }
 }
Beispiel #6
0
 public function onArmorChange(EntityArmorChangeEvent $event)
 {
     if ($event->getEntity() instanceof Player) {
         if ($this->disableArmorChange) {
             $event->setCancelled();
         }
     }
     return;
 }