예제 #1
0
 public function onPickUp(InventoryPickupItemEvent $event)
 {
     if ($event->getPlayer() instanceof Player && $this->plugin->status === "enabled" && $this->plugin->loginmanager[$event->getPlayer()->getId()] !== true && $this->plugin->allowPickup !== true) {
         $event->setCancelled(true);
     } elseif ($this->plugin->safemode === true and $this->plugin->status !== "enabled") {
         $event->setCancelled(true);
         $event->getPlayer()->sendMessage($this->disable);
     }
 }
예제 #2
0
 public function onPickupItem(InventoryPickupItemEvent $event)
 {
     $player = $event->getInventory()->getHolder();
     if (!$this->isLogin($player)) {
         $event->setCancelled();
         return true;
     }
 }
예제 #3
0
 public function onPickup(InventoryPickupItemEvent $event)
 {
     $player = $event->getInventory()->getHolder();
     if ($player instanceof Player) {
         if ($event->getItem()->getItem()->getId() === self::GUN_ID) {
             $this->players[$player->getName()][0]->addAmmo(30);
             if ($player->getInventory()->contains(Item::get(self::GUN_ID))) {
                 $event->getItem()->kill();
                 $event->setCancelled();
             }
         } else {
             $event->getItem()->kill();
         }
     }
 }
 /**
  * @param InventoryPickupItemEvent $event
  *
  * @priority LOWEST
  */
 public function onPickupItem(InventoryPickupItemEvent $event)
 {
     $player = $event->getInventory()->getHolder();
     if ($player instanceof Player and !$this->auth->isPlayerAuthenticated($player)) {
         $event->setCancelled(true);
     }
 }
 public function onPickupItem(InventoryPickupItemEvent $event)
 {
     $holder = $event->getInventory()->getHolder();
     if (!$holder instanceof Player) {
         return;
     }
     $session = $this->main->getSession($holder);
     if (!$session instanceof Session) {
         $event->setCancelled();
         return;
     }
     if ($session->onPickupItem($event) === false) {
         $event->setCancelled();
     }
 }
예제 #6
0
 public function h_onPickup(InventoryPickupItemEvent $event)
 {
     if (!$this->isLoggedIn()) {
         $event->setCancelled();
     }
 }
예제 #7
0
 /**
  * @param InventoryPickupItemEvent $event
  *
  * @priority HIGH
  * @ignoreCancelled true
  */
 public function onPickupItem(InventoryPickupItemEvent $event)
 {
     $player = $event->getInventory()->getHolder();
     if ($player instanceof Player and !$player->isOp()) {
         foreach ($this->plugin->getAllZones() as $zone) {
             if ($zone->isIn($event->getItem())) {
                 if ($player->hasPermission($zone->getName() . MEMBER)) {
                     break;
                 }
                 $event->setCancelled(true);
                 $player->sendMessage("[iZone] This is a private area.");
                 break;
             }
         }
     }
 }
예제 #8
0
 public function onPickup(InventoryPickupItemEvent $event)
 {
     $player = $event->getInventory()->getHolder();
     if ($player instanceof Player) {
         if ($this->inArena($player)) {
             if (!in_array($event->getItem()->getId(), $this->pickup)) {
                 if ($event->getItem()->getItem()->getId() == Item::BRICK) {
                     $event->setCancelled();
                     $player->getLevel()->removeEntity($event->getItem());
                     $this->pickup[] = $event->getItem()->getId();
                     $player->setExpLevel($player->getExpLevel() + 1);
                     $player->sendTip(TextFormat::GOLD . "+" . TextFormat::GREEN . "1 Level!");
                 }
                 if ($event->getItem()->getItem()->getId() == Item::IRON_INGOT) {
                     $event->setCancelled();
                     $player->getLevel()->removeEntity($event->getItem());
                     $this->pickup[] = $event->getItem()->getId();
                     $player->setExpLevel($player->getExpLevel() + 10);
                     $player->sendTip(TextFormat::GOLD . "+" . TextFormat::GREEN . "10 Level!");
                 }
                 if ($event->getItem()->getItem()->getId() == Item::GOLD_INGOT) {
                     $event->setCancelled();
                     $player->getLevel()->removeEntity($event->getItem());
                     $this->pickup[] = $event->getItem()->getId();
                     $player->setExpLevel($player->getExpLevel() + 20);
                     $player->sendTip(TextFormat::GOLD . "+" . TextFormat::GREEN . "20 Level!");
                 }
             }
         }
     }
 }
예제 #9
0
 public function onPick(InventoryPickupItemEvent $event)
 {
     $inv = $event->getInventory();
     if (!$inv instanceof PlayerInventory) {
         return;
     }
     $player = $inv->getHolder();
     if (!$player instanceof Player) {
         return;
     }
     $user = $this->main->getUserByPlayer($player);
     if ($user === null or !$user->isPlaying()) {
         $event->setCancelled();
     }
 }
예제 #10
0
 public function onPickup(InventoryPickupItemEvent $event)
 {
     $player = $event->getInventory()->getHolder();
     if ($player instanceof Player) {
         $item = $event->getItem()->getItem();
         if (isset($this->loadedGuns[$item->getId() . ":" . $item->getDamage()])) {
             $gun = $this->players[$player->getName()][0];
             if ($gun->getGunItem() === $item->getId() . ":" . $item->getDamage()) {
                 $gun->addAmmo($gun->getMagazineAmmo());
                 $event->getItem()->kill();
             }
             $event->setCancelled();
         } else {
             $event->getItem()->kill();
         }
     }
 }
예제 #11
0
 public function onPickup(InventoryPickupItemEvent $event)
 {
     $inv = $event->getInventory();
     if (!$inv instanceof PlayerInventory) {
         return;
     }
     $player = $inv->getHolder();
     if (!$player instanceof Player) {
         return;
     }
     $session = $this->getMain()->getSessions()->getSession($player);
     if (!$session->inSession($this)) {
         return;
     }
     $item = $event->getItem();
     if ($item instanceof ItemBlock) {
         if ($item->getBlock() === Block::SNOW_BLOCK) {
             $event->setCancelled();
         }
     }
 }