Пример #1
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.");
     }
 }
Пример #2
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;
 }
Пример #3
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);
 }
Пример #4
0
 public function onInventoryOpenEvent(InventoryOpenEvent $ev)
 {
     if ($ev->isCancelled()) {
         return;
     }
     $inv = $ev->getInventory();
     if (!$this->isTreChe($inv)) {
         return;
     }
     $this->loadInventory($inv);
 }
Пример #5
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.");
     }
 }