Ejemplo n.º 1
0
 public function onPlayerDeath(PlayerDeathEvent $e)
 {
     $pl = $e->getEntity();
     if (!$pl instanceof Player) {
         return;
     }
     if (!$pl->hasPermission("gb.cdeath")) {
         return;
     }
     $keepinv = $this->keepinv;
     if ($keepinv == "perms") {
         foreach (["keep", "nodrops", "default"] as $m) {
             if ($pl->hasPermission("gb.keepinv." . $m)) {
                 break;
             }
         }
     }
     switch ($keepinv) {
         case "keep":
             $e->setKeepInventory(true);
             $e->setDrops([]);
             break;
         case "nodrops":
             $e->setKeepInventory(false);
             $e->setDrops([]);
             break;
     }
 }
Ejemplo n.º 2
0
 public function onDeath(PlayerDeathEvent $event)
 {
     $this->clearjoin = $this->getConfig()->get("Clear on Death");
     if ($this->clearjoin == true) {
         $event->setDrops(array(Item::get(0, 0, 0)));
     }
 }
Ejemplo n.º 3
0
 public function onDeath(PlayerDeathEvent $event)
 {
     $cfg = $this->getConfig();
     $enable = $cfg->get("enable");
     if ($event->getEntity() instanceof Player and $enable !== true) {
         $event->setDrops([]);
     }
 }
 public function onPlayerDeath(PlayerDeathEvent $event)
 {
     $deadPlayer = $event->getEntity();
     $arena = $this->arenaManager->getPlayerArena($deadPlayer);
     if ($arena != NULL) {
         $event->setDrops([]);
         $event->setKeepInventory(false);
         $arena->onPlayerDeath($deadPlayer);
     }
 }
Ejemplo n.º 5
0
 public function onDeath(PlayerDeathEvent $event)
 {
     $event->setDrops([]);
     if (isset($this->attackQueue[$event->getEntity()->getName()])) {
         $damager = $this->getServer()->getPlayerExact($this->attackQueue[$event->getEntity()->getName()]);
         if (!$damager instanceof Player) {
             return;
         }
         $amount = $this->db["payback"];
         $this->economyAPI->addMoney($damager, $amount);
         $message = str_replace("%money%", $amount, $this->get("pvpmoney-paid"));
         $this->message($damager, $message);
         unset($this->attackQueue[$event->getEntity()->getName()]);
     }
 }
Ejemplo n.º 6
0
 public function onDeath(PlayerDeathEvent $event)
 {
     $p = $event->getEntity();
     $level = $p->getLevel();
     $light = new AddEntityPacket();
     $light->type = 93;
     $light->eid = Entity::$entityCount++;
     $light->metadata = array();
     $light->speedX = 0;
     $light->speedY = 0;
     $light->speedZ = 0;
     $light->yaw = $p->getYaw();
     $light->pitch = $p->getPitch();
     $light->x = $p->x;
     $light->y = $p->y;
     $light->z = $p->z;
     foreach ($level->getPlayers() as $pl) {
         $pl->dataPacket($light);
         $event->setDrops(array(Item::get(322, 1, 1)));
     }
 }
Ejemplo n.º 7
0
 public function h_onDeath(PlayerDeathEvent $event)
 {
     $event->setDrops([]);
     $event->setDeathMessage("");
     $event->setKeepInventory(false);
 }
Ejemplo n.º 8
0
 public function onDeath(PlayerDeathEvent $event)
 {
     $player = $event->getEntity();
     if (isset(FlameThrower::$tasks[$player->getName()])) {
         FlameThrower::$tasks[$player->getName()]->getHandler()->cancel();
     }
     if ($this->status === self::STAT_GAME_IN_PROGRESS) {
         $items = $event->getDrops();
         foreach ($items as $key => $item) {
             if ($item->getId() !== self::GUN_ID) {
                 unset($items[$key]);
             }
         }
         $event->setDrops($items);
         $cause = $player->getLastDamageCause();
         if ($cause !== null && $cause->getCause() == EntityDamageEvent::CAUSE_FALL) {
             if ($this->players[$player->getName()][2] === self::TEAM_BLUE) {
                 $playerColor = TextFormat::BLUE;
                 $damagerColor = TextFormat::RED;
                 $this->score[self::TEAM_RED]++;
             } else {
                 $playerColor = TextFormat::RED;
                 $damagerColor = TextFormat::BLUE;
                 $this->score[self::TEAM_BLUE]++;
             }
             $firstKill = "";
             if ($this->score[self::TEAM_BLUE] + $this->score[self::TEAM_RED] <= 1) {
                 $firstKill = TextFormat::YELLOW . "FIRST BLOOD\n" . TextFormat::WHITE;
             }
             $this->broadcastPopup($firstKill . $playerColor . $player->getName() . $damagerColor . " SUICIDED");
         }
         if (!$cause instanceof EntityDamageByEntityEvent) {
             return;
         }
         if ($cause !== null and $cause->getCause() === 15) {
             $damager = $cause->getDamager();
             if ($damager instanceof Player) {
                 if ($this->players[$damager->getName()][2] === self::TEAM_BLUE) {
                     $damagerColor = TextFormat::BLUE;
                     $playerColor = TextFormat::RED;
                     $this->score[self::TEAM_BLUE]++;
                 } else {
                     $damagerColor = TextFormat::RED;
                     $playerColor = TextFormat::BLUE;
                     $this->score[self::TEAM_RED]++;
                 }
                 $firstKill = "";
                 if ($this->score[self::TEAM_BLUE] + $this->score[self::TEAM_RED] <= 1) {
                     $firstKill = TextFormat::YELLOW . "FIRST BLOOD\n" . TextFormat::WHITE;
                 }
                 $this->broadcastPopup($firstKill . $damagerColor . $damager->getName() . TextFormat::WHITE . " -> " . $playerColor . $player->getName());
                 ++$this->killDeath[0][$damager->getName()];
                 ++$this->killDeath[1][$player->getName()];
                 $this->level[$damager->getName()] += $damager->getHealth() * 5;
                 $level = floor($this->level[$damager->getName()] / 10000);
                 $damager->setNameTag("Lv." . $level . $damagerColor . $damager->getName());
             }
         } elseif ($cause !== null and $cause->getCause() === 16) {
             $damager = $cause->getDamager();
             if ($damager instanceof Player) {
                 if ($this->players[$damager->getName()][2] === self::TEAM_BLUE) {
                     $damagerColor = TextFormat::BLUE;
                     $playerColor = TextFormat::RED;
                     $this->score[self::TEAM_BLUE]++;
                 } else {
                     $damagerColor = TextFormat::RED;
                     $playerColor = TextFormat::BLUE;
                     $this->score[self::TEAM_RED]++;
                 }
                 $firstKill = "";
                 if ($this->score[self::TEAM_BLUE] + $this->score[self::TEAM_RED] <= 1) {
                     $firstKill = TextFormat::YELLOW . "FIRST BLOOD\n" . TextFormat::WHITE;
                 }
                 $this->broadcastPopup($firstKill . $damagerColor . $damager->getName() . TextFormat::WHITE . " -O-> " . $playerColor . $player->getName());
                 ++$this->killDeath[0][$damager->getName()];
                 ++$this->killDeath[1][$player->getName()];
                 $this->level[$damager->getName()] += $damager->getHealth() * 5;
                 $level = floor($this->level[$damager->getName()] / 10000);
                 $damager->setNameTag("Lv." . $level . $damagerColor . $damager->getName());
             }
         }
         $event->setDeathMessage("");
     }
 }
Ejemplo n.º 9
0
 public function onDeath(PlayerDeathEvent $event)
 {
     $event->setDrops([]);
     if (isset($this->touchedQueue[$event->getEntity()->getName()])) {
         if (count($this->touchedQueue[$event->getEntity()->getName()]) <= 25) {
             foreach ($this->touchedQueue[$event->getEntity()->getName()] as $pos) {
                 $pos = explode(".", $pos);
                 if (!isset($pos[2])) {
                     continue;
                 }
                 $this->setBlockPacket($event->getEntity(), $pos[0], $pos[1], $pos[2], Block::DIAMOND_BLOCK);
             }
         }
         unset($this->touchedQueue[$event->getEntity()->getName()]);
     }
     if (isset($this->attackQueue[$event->getEntity()->getName()])) {
         $damager = $this->getServer()->getPlayerExact($this->attackQueue[$event->getEntity()->getName()]);
         if (!$damager instanceof Player) {
             return;
         }
         $this->KillUpdate($damager, $event->getEntity());
         unset($this->attackQueue[$event->getEntity()->getName()]);
     }
 }
Ejemplo n.º 10
0
 public function onPlayerDeath(PlayerDeathEvent $event)
 {
     $Player = $event->getEntity();
     $Level = $Player->getLevel();
     if (!$this->plugin->game || $this->plugin->game->level_name != $Level->getFolderName()) {
         return;
     }
     $event->setDrops(array());
     if ($Team = $this->plugin->game->getTeamByPlayer($Player)) {
         $this->plugin->game->PopupInfo2->PlayersData[strtolower($Player->getName())][1] = 0;
         if ($Team->BedStatus == 0) {
             if (($Idx = array_search($Player, $Team->Players)) !== false) {
                 array_splice($Team->Players, $Idx, 1);
                 $this->plugin->game->updateTeams();
             }
         }
     }
 }
Ejemplo n.º 11
0
 public function onDeath(PlayerDeathEvent $event)
 {
     $player = $event->getEntity();
     if ($player instanceof Player) {
         if ($this->inArena($player)) {
             $event->setDeathMessage("");
             $arena = $this->getArena($player);
             $cause = $player->getLastDamageCause();
             $players = $this->getPlayers($arena);
             if ($cause instanceof EntityDamageByEntityEvent) {
                 $killer = $cause->getDamager();
                 $event->setDrops(array());
                 if ($killer instanceof Player) {
                     foreach ($players as $pn) {
                         $p = $this->getServer()->getPlayerExact($pn);
                         if ($p != null) {
                             $p->sendMessage($this->prefix . $killer->getNameTag() . TextFormat::GRAY . " hat " . $player->getNameTag() . TextFormat::GRAY . " getötet!");
                         }
                     }
                 } else {
                     foreach ($players as $pn) {
                         $p = $this->getServer()->getPlayerExact($pn);
                         if ($p != null) {
                             $p->sendMessage($this->prefix . $player->getNameTag() . TextFormat::GRAY . " ist gestorben!");
                         }
                     }
                 }
             } else {
                 $event->setDrops(array());
                 foreach ($players as $pn) {
                     $p = $this->getServer()->getPlayerExact($pn);
                     if ($p != null) {
                         if ($this->lasthit[$player->getName()] != "no") {
                             $p2 = $this->getServer()->getPlayerExact($this->lasthit[$player->getName()]);
                             if ($p2 != null) {
                                 $p->sendMessage($this->prefix . $p2->getNameTag() . TextFormat::WHITE . " hat " . $player->getNameTag() . TextFormat::WHITE . " getötet!");
                                 $this->lasthit[$player->getName()] = "no";
                             } else {
                                 $p->sendMessage($this->prefix . $player->getNameTag() . TextFormat::GRAY . " ist gestorben!");
                             }
                         } else {
                             $p->sendMessage($this->prefix . $player->getNameTag() . TextFormat::GRAY . " ist gestorben!");
                         }
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 12
0
 public function onDeath(PlayerDeathEvent $e)
 {
     $p = $e->getEntity();
     if (!$p instanceof Player) {
         return;
     }
     if ($this->deathpos !== null) {
         $n = strtolower($p->getName());
         $this->deathpos[$n] = new Position($p->getX(), $p->getY(), $p->getZ(), $p->getLevel());
     }
     switch ($this->deathinv) {
         case "keep":
             if (!$p->hasPermission("spawnmgr.keepinv")) {
                 return;
             }
             $e->setKeepInventory(true);
             $e->setDrops([]);
             break;
         case "clear":
             if (!$p->hasPermission("spawnmgr.nodrops")) {
                 return;
             }
             $e->setKeepInventory(false);
             $e->setDrops([]);
             break;
         case "perms":
             if ($p->hasPermission("spawnmgr.keepinv")) {
                 $e->setKeepInventory(true);
             }
             if ($p->hasPermission("spawnmgr.nodrops")) {
                 $e->setDrops([]);
             }
             break;
     }
 }
Ejemplo n.º 13
0
 public function onPlayerDeath(PlayerDeathEvent $event)
 {
     if (!$this->isValidPlayer($event->getEntity())) {
         return;
     }
     $event->getEntity()->teleport($this->getServer()->getDefaultLevel()->getSpawnLocation());
     $rpgPlayer = $this->players[$event->getEntity()->getName()];
     $rpgPlayer->setHealth(1);
     $rpgPlayer->mana = 0;
     $rpgPlayer->getStatus()->setXp($rpgPlayer->getStatus()->getXp() * (4 / 5));
     $drops = [];
     $this->respawnAdd[$event->getEntity()->getName()] = [];
     foreach ($event->getDrops() as $item) {
         if ($rpgPlayer->getSkillByItem($item) === null) {
             $drops[] = $item;
         } else {
             $this->respawnAdd[$event->getEntity()->getName()][] = $item;
         }
     }
     $event->setDrops($drops);
 }
Ejemplo n.º 14
0
 public function onDeath(PlayerDeathEvent $e)
 {
     $p = $e->getEntity();
     if ($p instanceof Player) {
         if ($this->getPlayerMode($p) === 0 || $this->getPlayerMode($p) === 2) {
             $e->setDeathMessage("");
         }
         if ($this->getPlayerMode($p) === 1) {
             $this->plugin->getServer()->getPluginManager()->callEvent($event = new PlayerLoseArenaEvent($this->plugin, $p, $this));
             $e->setDeathMessage("");
             $e->setDrops([]);
             $ingame = array_merge($this->lobbyp, $this->ingamep, $this->spec);
             $this->checkWinners($p);
             unset($this->ingamep[strtolower($p->getName())]);
             $this->spec[strtolower($p->getName())] = $p;
             foreach ($ingame as $pl) {
                 $pl->sendMessage($this->plugin->getPrefix() . str_replace(['%2', '%1'], [count($this->ingamep), $p->getName()], $this->plugin->getMsg('death')));
             }
             $this->checkAlive();
         }
     }
 }