Inheritance: extends InventoryEvent, implements pocketmine\event\Cancellable
Beispiel #1
1
 public function h_onOpenInv(InventoryOpenEvent $event)
 {
     if (!$this->isLoggedIn()) {
         $event->setCancelled();
     }
 }
Beispiel #2
0
 public function InventoryOpenEvent(InventoryOpenEvent $event)
 {
     $player = $event->getPlayer();
     if ($event->getInventory()->getType()->get(0)) {
         $event->setCancelled(true);
         $player->sendMessage($player->getName() . "님이 " . $event->getInventory()->getSize() . "와 " . $event->getInventory()->getMaxStackSize() . "만큼의 인벤토리 수를 가지며 " . $event->getInventory()->getHolder() . "좌표에서 " . $event->getInventory()->getTitle() . "을 사용하셨습니다.");
     }
     //getsize 인벤토리 크기?  getMaxStackSize() 인벤토리 수  getHolder() 인벤토리를 연 좌표  getTitle()인벤토리가 플레이어인지 상자인지 등등 구분
 }
 /**
  * @param InventoryOpenEvent $event
  * @priority HIGH
  */
 public function h_onOpenInv(InventoryOpenEvent $event)
 {
     if (isset($this->sessions[$offset = Session::offset($event->getPlayer())])) {
         $this->sessions[$offset = Session::offset($event->getPlayer())]->h_onOpenInv($event);
         $this->sessions[$offset]->activity();
     }
 }
Beispiel #4
0
 public function onInventoryOpen(InventoryOpenEvent $event)
 {
     if (isset($this->needAuth[$event->getPlayer()->getName()])) {
         $event->setCancelled();
         $this->deauthenticatePlayer($event->getPlayer());
     }
 }
Beispiel #5
0
 public function open(Player $who)
 {
     $who->getServer()->getPluginManager()->callEvent($ev = new InventoryOpenEvent($this, $who));
     if ($ev->isCancelled()) {
         return \false;
     }
     $this->onOpen($who);
     return \true;
 }
Beispiel #6
0
 public function onInventoryOpenEvent(InventoryOpenEvent $ev)
 {
     if ($ev->isCancelled()) {
         return;
     }
     $player = $ev->getPlayer();
     $inv = $ev->getInventory();
     if (!$this->isNeChest($inv)) {
         return;
     }
     if (!$this->lockChest($player, $inv)) {
         $player->sendTip(mc::_("That NetherChest is in use!"));
         $ev->setCancelled();
         return;
     }
     $player->sendMessage(mc::_("Opening NetherChest!"));
     $this->loadInventory($player, $inv);
 }
 /**
  * @param InventoryOpenEvent $event
  *
  * @priority LOWEST
  */
 public function onInventoryOpen(InventoryOpenEvent $event)
 {
     if (!$this->auth->isPlayerAuthenticated($event->getPlayer())) {
         $event->setCancelled(true);
     }
 }
 public function onOpenInv(InventoryOpenEvent $event)
 {
     if ($event->getInventory()->getHolder() === $event->getPlayer()) {
         return;
     }
     $session = $this->main->getSession($event->getPlayer());
     if (!$session instanceof Session) {
         $event->setCancelled();
         return;
     }
     if ($session->onOpenInv($event) === false) {
         $event->setCancelled();
     }
 }
 public function onOpen(InventoryOpenEvent $event)
 {
     $Player = $event->getPlayer();
     $Level = $Player->getLevel();
     $Inventory = $event->getInventory();
     $Holder = $Inventory->getHolder();
     if (!$this->plugin->game || $this->plugin->game->level_name != $Level->getFolderName()) {
         return;
     }
     $X = $Holder->getX();
     $Y = $Holder->getY();
     $Z = $Holder->getZ();
     foreach ($this->plugin->game->LevelData["spawners"] as $spawner) {
         $spawner = explode(" ", $spawner);
         $type = $spawner[0];
         $x = $spawner[1];
         $y = $spawner[2];
         $z = $spawner[3];
         if ($x == $X && $y == $Y && $z == $Z) {
             $this->plugin->setState("buying_chest", $Player, $Inventory);
             $this->plugin->setState("buying_type", $Player, 2);
         }
     }
 }
Beispiel #10
0
 public function onInventoryOpen(InventoryOpenEvent $event)
 {
     if ($event->getPlayer()->getInventory() !== $event->getInventory()) {
         $event->setCancelled($this->isLogin($event->getPlayer()) ? false : true);
     }
 }
Beispiel #11
0
 public function onInventoryOpenEvent(InventoryOpenEvent $ev)
 {
     if ($ev->isCancelled()) {
         return;
     }
     $inv = $ev->getInventory();
     if (!$this->isTreChe($inv)) {
         return;
     }
     $this->loadInventory($inv);
 }
Beispiel #12
0
 public function onInventoryOpenEvent(InventoryOpenEvent $ev)
 {
     if ($ev->isCancelled()) {
         return;
     }
     $player = $ev->getPlayer();
     $inv = $ev->getInventory();
     if (!$this->isCrate($inv)) {
         return;
     }
     if ($ev->getPlayer()->getInventory()->getItemInHand()->getId() == 341) {
         $ev->getPlayer()->getInventory()->removeItem(Item::get(341, 0, 1));
         $armour = array("306", "306", "306", "306", "307", "307", "307", "307", "308", "308", "308", "308", "309", "309", "309", "309", "310", "310", "310", "310", "311", "311", "311", "311", "312", "312", "312", "312", "313", "313", "313", "313", "302", "303", "304", "305", "314", "315", "316", "317");
         $am = $armour[array_rand($armour)];
         $amount = array("1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1");
         $a = $amount[array_rand($amount)];
         $ev->getPlayer()->getInventory()->addItem(Item::get($am, 0, $a));
         $ev->getPlayer()->sendMessage(TextFormat::GREEN . "---------------");
         $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Redeemed Armour Crate!");
         $ev->getPlayer()->sendMessage(TextFormat::GREEN . "---------------");
         $ev->getPlayer()->sendMessage(TextFormat::AQUA . " ITEMS WON:");
         if ($am == 306) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Iron Helmet  x" . $a);
         } elseif ($am == 307) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Iron Chestplate  x" . $a);
         } elseif ($am == 308) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Iron Leggings  x" . $a);
         } elseif ($am == 309) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Iron Boots  x" . $a);
         } elseif ($am == 310) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Diamond Helmet  x" . $a);
         } elseif ($am == 311) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Diamond Chestplate  x" . $a);
         } elseif ($am == 312) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Diamond Leggings  x" . $a);
         } elseif ($am == 313) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Diamond Boots  x" . $a);
         } elseif ($am == 302) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Chain Helmet  x" . $a);
         } elseif ($am == 303) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Chain Chestplate  x" . $a);
         } elseif ($am == 304) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Chain Leggings  x" . $a);
         } elseif ($am == 305) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Chain Boots  x" . $a);
         } elseif ($am == 314) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Gold Helmet  x" . $a);
         } elseif ($am == 315) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Gold Chestplate  x" . $a);
         } elseif ($am == 316) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Gold Leggings  x" . $a);
         } elseif ($am == 317) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Gold Boots  x" . $a);
         }
         $ev->setCancelled();
     } else {
         $ev->getPlayer()->sendMessage(TextFormat::RED . "------------------");
         $ev->getPlayer()->sendMessage(TextFormat::YELLOW . " Armour CRATE");
         $ev->getPlayer()->sendMessage(TextFormat::RED . "------------------");
         $ev->getPlayer()->sendMessage(TextFormat::AQUA . "Win up to Diamond Armour!");
         $ev->getPlayer()->sendMessage(TextFormat::RED . "------------------");
         $ev->setCancelled();
         $ev->getPlayer()->sendTip(TextFormat::AQUA . "USE /vote TO GET A KEY.");
         $ev->getPlayer()->sendTip(TextFormat::GREEN . "USE /vote TO GET A KEY.");
         $ev->getPlayer()->sendTip(TextFormat::AQUA . "USE /vote TO GET A KEY.");
         $ev->getPlayer()->sendTip(TextFormat::GREEN . "USE /vote TO GET A KEY.");
         $ev->getPlayer()->sendTip(TextFormat::AQUA . "USE /vote TO GET A KEY.");
         $ev->getPlayer()->sendTip(TextFormat::GREEN . "USE /vote TO GET A KEY.");
         $ev->getPlayer()->sendTip(TextFormat::AQUA . "USE /vote TO GET A KEY.");
         $ev->getPlayer()->sendTip(TextFormat::GREEN . "USE /vote TO GET A KEY.");
         $ev->getPlayer()->sendTip(TextFormat::AQUA . "USE /vote TO GET A KEY.");
     }
 }
Beispiel #13
0
 public function onInventoryOpenEvent(InventoryOpenEvent $ev)
 {
     if ($ev->isCancelled()) {
         return;
     }
     $player = $ev->getPlayer();
     $inv = $ev->getInventory();
     if (!$this->isCrate($inv)) {
         return;
     }
     if ($ev->getPlayer()->getInventory()->getItemInHand()->getId() == 341) {
         $ev->getPlayer()->getInventory()->removeItem(Item::get(341, 0, 1));
         $drugs = array("357", "357", "357", "357", "338", "338", "338", "338", "338", "338", "338", "338", "353", "353", "353", "353", "353", "353", "32", "32", "32", "32", "32", "32", "32", "32", "32", "32", "39", "39", "39", "39", "39", "39", "287", "287", "287", "361", "361", "362", "289", "289", "289");
         $d = $drugs[array_rand($drugs)];
         $amount = array("10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "32", "32", "32", "32", "32", "32", "32", "32", "32", "32", "32", "32", "32", "32", "64", "64", "64", "64", "64");
         $a = $amount[array_rand($amount)];
         $ev->getPlayer()->getInventory()->addItem(Item::get($d, 0, $a));
         $ev->getPlayer()->sendMessage(TextFormat::GREEN . "---------------");
         $ev->getPlayer()->sendMessage(TextFormat::BOLD . "§6Redeemed Crate!");
         $ev->getPlayer()->sendMessage(TextFormat::GREEN . "---------------");
         $ev->getPlayer()->sendMessage(TextFormat::BOLD . "§bITEMS WON:");
         if ($d == 357) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "PotCookie  x" . $a);
         } elseif ($d == 338) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Weed  x" . $a);
         } elseif ($d == 353) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Cocaine  x" . $a);
         } elseif ($d == 32) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Hash  x" . $a);
         } elseif ($d == 39) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "MagicMushroom  x" . $a);
         } elseif ($d == 287) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Molly  x" . $a);
         } elseif ($d == 361) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Steroids  x" . $a);
         } elseif ($d == 362) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "Opium  x" . $a);
         } elseif ($d == 289) {
             $ev->getPlayer()->sendMessage(TextFormat::GOLD . "POWDER x" . $a);
         }
         $ev->setCancelled();
     } else {
         $ev->getPlayer()->sendMessage(TextFormat::RED . "------------------");
         $ev->getPlayer()->sendMessage(TextFormat::YELLOW . " DRUG CRATE");
         $ev->getPlayer()->sendMessage(TextFormat::RED . "------------------");
         $ev->getPlayer()->sendMessage(TextFormat::AQUA . "Win up to 64 drugs!");
         $ev->getPlayer()->sendMessage(TextFormat::RED . "------------------");
         $ev->setCancelled();
         $ev->getPlayer()->sendTip(TextFormat::AQUA . "USE /vote TO GET A CRATEKEY.");
         $ev->getPlayer()->sendTip(TextFormat::AQUA . "USE /vote TO GET A CRATEKEY.");
         $ev->getPlayer()->sendTip(TextFormat::AQUA . "USE /vote TO GET A CRATEKEY.");
         $ev->getPlayer()->sendTip(TextFormat::AQUA . "USE /vote TO GET A CRATEKEY.");
         $ev->getPlayer()->sendTip(TextFormat::AQUA . "USE /vote TO GET A CRATEKEY.");
         $ev->getPlayer()->sendTip(TextFormat::AQUA . "USE /vote TO GET A CRATEKEY.");
         $ev->getPlayer()->sendTip(TextFormat::AQUA . "USE /vote TO GET A CRATEKEY.");
         $ev->getPlayer()->sendTip(TextFormat::AQUA . "USE /vote TO GET A CRATEKEY.");
         $ev->getPlayer()->sendTip(TextFormat::AQUA . "USE /vote TO GET A CRATEKEY.");
     }
 }