/** * @priority LOW */ public function onPlayerDeath(PlayerDeathEvent $e) { list($timer, $msg) = $this->getState($e->getEntity(), [0, ""]); if (time() - $timer > 1) { return; } $e->setDeathMessage($msg); $this->unsetState($e->getEntity()); }
public function onDeath(PlayerDeathEvent $event) { $player = $event->getEntity(); if ($player instanceof Player) { $name = $player->getName(); $level = $player->getLevel()->getName(); $disabledWorlds = $this->getConfig()->getNested("go-to-server-spawn-on-death"); foreach ($disabledWorlds as $disabledWorld) { if ($disabledWorld === $level) { return; } else { $this->temp->setNested("{$name}", $level); $this->temp->save(); } } } }
public function onDeath(PlayerDeathEvent $event) { foreach ($this->tntRun->arenas as $arena) { if ($arena->getPlayerManager()->isPlaying($event->getEntity())) { $arena->getPlayerHandler()->leavePlayer($event->getEntity()); return; } } }
public function onPlayerDeath(PlayerDeathEvent $event) { $p = $event->getEntity(); $pos = $event->getEntity()->getPosition(); if ($pos->y <= 0) { $pos->add(0, -$pos->y, 0); } $pos->add(0, 1, 0); $p->setSpawn($pos); }
public function onDeath(PlayerDeathEvent $event) { if ($event->getEntity()->getLastDamageCause() instanceof EntityDamageByEntityEvent) { $killer = $event->getEntity()->getLastDamageCause()->getDamager(); if ($killer instanceof Player) { $this->plugin->updatePlayer($event->getEntity(), "deaths"); $this->plugin->updatePlayer($killer, "kills"); } } }
/** * @param PlayerDeathEvent $event * * @priority LOWEST * @ignoreCancelled true */ public function PlayerDeathEvent(PlayerDeathEvent $event) { if (isset($this->players[$event->getEntity()->getName()])) { unset($this->players[$event->getEntity()->getName()]); if (isset($this->tasks[$event->getEntity()->getName()])) { $this->getServer()->getScheduler()->cancelTask($this->tasks[$event->getEntity()->getName()]); } unset($this->tasks[$event->getEntity()->getName()]); } }
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()]); } }
public function onPlayerDeathEvent(PlayerDeathEvent $event) { $cfg = $this->getConfig(); $duration = $cfg->get("Duration"); $particles = $cfg->get("Particles"); $amplifier = $cfg->get("Amplifier"); $give = $cfg->get("Add-Money"); $lose = $cfg->get("Lost-Money"); $id = $cfg->get("Effect-ID"); $effect = Effect::getEffect($id); $effect->setVisible($particles); $effect->setAmplifier($amplifier); $effect->setDuration($duration); $player = $event->getEntity(); $name = strtolower($player->getName()); if ($player instanceof Player) { $cause = $player->getLastDamageCause(); if ($cause instanceof EntityDamageByEntityEvent) { $damager = $cause->getDamager(); if ($damager instanceof Player) { $damager->sendMessage("You killed " . $player . ".\nYou earn \$" . $give . " for getting a kill and an effect!"); $damager->addEffect($effect); $this->money->addMoney($damager, $give); $player->sendMessage("You were killed by " . $damager); $this->money->reduceMoney($player, $lose); } } } }
public function onDeath(PlayerDeathEvent $event) { $cause = $event->getEntity()->getLastDamageCause(); if ($cause instanceof EntityDamageByEntityEvent) { $player = $event->getEntity(); $killer = $event->getEntity()->getLastDamageCause()->getDamager(); $fizz = new FizzSound($killer); $bat = new BatSound($player); $player->sendMessage(TextFormat::RED . $killer->getName() . TextFormat::GOLD . " Killed you with " . TextFormat::LIGHT_PURPLE . $killer->getHealth() . TextFormat::RED . " hearts left and while using " . TextFormat::BLUE . $killer->getInventory()->getItemInHand() . "!"); $player->getLevel()->addSound($bat); if ($killer instanceof Player) { $killer->sendMessage(TextFormat::GREEN . "You Killed " . $player->getName() . "!"); $killer->getLevel()->addSound($fizz); } } }
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; } }
public function onDeath(PlayerDeathEvent $event) { $player = $event->getEntity(); if (Main::isActive($player)) { Main::removeActive($player); } }
public function onDeath(PlayerDeathEvent $event) { $player = $event->getEntity(); if ($this->plugin->isActive($player)) { $this->plugin->removeActive($player); } }
public function onPlayerDeathEvent(PlayerDeathEvent $event) { if ($event->getEntity() instanceof Player) { $player = $event->getEntity(); $name = $event->getEntity()->getName(); if ($this->allEnabled == "true") { $event->setKeepInventory(true); $player->sendMessage(TextFormat::YELLOW . "Your inventory has been saved"); } else { if (in_array($name, $this->playersEnabled)) { $event->setKeepInventory(true); $player->sendMessage(TextFormat::YELLOW . "Your inventory has been saved"); } } } }
public function onDeath(PlayerDeathEvent $event) { $cfg = $this->getConfig(); $enable = $cfg->get("enable"); if ($event->getEntity() instanceof Player and $enable !== true) { $event->setDrops([]); } }
public function onDeath(PlayerDeathEvent $event) { $this->plugin->players = $this->plugin->players - 1; $d = $this->plugin->points->get($event->getEntity()->getName()); $d["deaths"] = $d["deaths"] + 1; $killer = $event->getEntity()->getLastDamageCause()->getCause()->getDamager(); if ($killer instanceof Player) { $k = $this->plugin->points->get($killer->getName()); $k["kills"] = $k["kills"] + 1; } $event->getEntity()->kick("Death"); $event->setDeathMessage("[HG] " . $event->getEntity()->getName() . " died!\nThere are " . $this->plugin->players . " left."); if ($this->plugin->players <= 1) { $this->plugin->getServer()->broadcastMessage("[HG] Game ended!"); $this->plugin->getServer()->shutdown(); } }
public function onDeath(PlayerDeathEvent $ev) { $p = $ev->getEntity(); if (!$p instanceof Player) { return; } $this->setState($p, [$p->getX(), $p->getY(), $p->getZ(), $p->getLevel()->getName()]); }
public function onDeath(PlayerDeathEvent $event) { if (!$this->killedByBlock) { return; } $this->killedByBlock = false; $event->setDeathMessage(null); $this->getServer()->broadcastMessage($this->getCustomMessage($event->getEntity())); }
function fae(rgarg $E) { $B = $E->getEntity(); $D = $B->getName(); if (isset($this->link[$D])) { $this->geahaajt($this->link[$D], $B->getId()); unset($this->link[$D]); } }
/** * @priority MONITOR */ public function onDeath(PlayerDeathEvent $ev) { $player = $ev->getEntity(); if (!$player instanceof Player) { return; } for ($i = 0; $i < 20; $i++) { $player->getLevel()->addParticle(new DustParticle(self::randVector($player), mt_rand() / mt_getrandmax() * 2, 0, 64, 0)); } }
public function onPlayerDeath(PlayerDeathEvent $event) { $deadPlayer = $event->getEntity(); $arena = $this->arenaManager->getPlayerArena($deadPlayer); if ($arena != NULL) { $event->setDrops([]); $event->setKeepInventory(false); $arena->onPlayerDeath($deadPlayer); } }
public function onPlayerDeath(PlayerDeathEvent $event) { //Getting Victim $victim = $event->getEntity(); if ($victim instanceof Player) { $vdata = new Config($this->getDataFolder() . "data/" . strtolower($victim->getName()) . ".yml", Config::YAML); //Check victim data if ($vdata->exists("kills") && $vdata->exists("deaths")) { $vdata->set("deaths", $vdata->get("deaths") + 1); $vdata->save(); } else { $vdata->setAll(array("kills" => 0, "deaths" => 1)); //Add first death $vdata->save(); } $cause = $event->getEntity()->getLastDamageCause()->getCause(); if ($cause == 1) { //Killer is an entity //Get Killer Entity $killer = $event->getEntity()->getLastDamageCause()->getDamager(); //Get if the killer is a player if ($killer instanceof Player) { //Get killer data $kdata = new Config($this->getDataFolder() . "data/" . strtolower($killer->getName()) . ".yml", Config::YAML); //Check killer data if ($kdata->exists("kills") && $kdata->exists("deaths")) { $kdata->set("kills", $kdata->get("kills") + 1); $kdata->save(); } else { $kdata->setAll(array("kills" => 1, "deaths" => 0)); //Add first kill $kdata->save(); } } } } }
public function onDeath(PlayerDeathEvent $ent) { $player = $ent->getEntity(); $lightningbolt = new AddEntityPacket(); $lightningbolt->type = 93; $lightningbolt->eid = Entity::$entityCount++; $lightningbolt->metadata = array(); $lightningbolt->speedX = 0; $lightningbolt->speedY = 0; $lightningbolt->speedZ = 0; $lightningbolt->x = $player->x; $lightningbolt->y = $player->y; $lightningbolt->z = $player->z; $player->dataPacket($lightningbolt); }
public function onPlayerDeathEvent(PlayerDeathEvent $event) { $player = $event->getEntity(); if ($player instanceof Player) { $cause = $player->getLastDamageCause(); if ($cause instanceof EntityDamageByEntityEvent) { $damager = $cause->getDamager(); if ($damager instanceof Player) { $damagername = strtolower($damager->getName()); $this->config->setNested($damagername . ".kills", $this->config->getNested($damagername . ".kills") + 1); $this->config->save(); // Important! } } } }
public function onDeath(PlayerDeathEvent $event) { $player = $event->getEntity(); if ($player->isOp()) { return; } if ($this->ghost[$player->getName()] == false && $this->config["Enable"] == true) { $player->setHealth(20); if ($player->getY() < 0) { $player->teleport($player->getLevel()->getSpawnLocation()); } $this->inventory[$player->getName()]["inventory"] = $player->getInventory()->getContents(); $player->setGamemode(3); $this->alert($player, "당신은 유령이 되었습니다."); $this->alert($player, $this->config["sec"] . "초 후 리스폰합니다."); $this->setGhost($player, true); $this->getServer()->getScheduler()->scheduleDelayedTask(new GhostTask($this, $player), $this->config["sec"] * 20); } }
public function onPlayerDeath(PlayerDeathEvent $ev) { $player = $ev->getEntity(); $playername = $player->getName(); $cause = $player->getLastDamageCause(); if ($cause instanceof EntityDamageByEntityEvent) { $killer = $cause->getDamager(); switch ($cause->getCause()) { case EntityDamageEvent::CAUSE_ENTITY_ATTACK: case EntityDamageEvent::CAUSE_PROJECTILE: if ($cause instanceof EntityDamageByEntityEvent) { $killer->sendMessage(str_replace(array("%killer", "%injured", "%earn", "%take"), array($killer->getName(), $player->getName(), $this->config->get("Killer-Add-Coin"), $this->config->get("Killer-Take-Coin")), $this->config->get("Killer-Message"))); $player->sendMessage(str_replace(array("%killer", "%injured", "%earn", "%take"), array($killer->getName(), $player->getName(), $this->config->get("Injured-Add-Coin"), $this->config->get("Injured-Take-Coin")), $this->config->get("Injured-Message"))); //Message //Below Killer if ($this->config->get("Economy-Plugin") == "EconomyAPI") { $this->getServer()->getPluginManager()->getPlugin("EconomyAPI")->addMoney($killer->getName(), $this->config->get("Killer-Add-Coin")); } elseif ($this->config->get("Economy-Plugin") == "PocketMoney") { $this->getServer()->getPluginManager()->getPlugin("PocketMoney")->grantMoney($killer->getName(), $this->config->get("Killer-Add-Coin")); } if ($this->config->get("Economy-Plugin") == "EconomyAPI") { $this->getServer()->getPluginManager()->getPlugin("EconomyAPI")->reduceMoney($killer->getName(), $this->config->get("Killer-Take-Coin")); } elseif ($this->config->get("Economy-Plugin") == "PocketMoney") { $this->getServer()->getPluginManager()->getPlugin("PocketMoney")->grantMoney($killer->getName(), "-" . $this->config->get("Killer-Take-Coin")); } //Below Injured Person if ($this->config->get("Economy-Plugin") == "EconomyAPI") { $this->getServer()->getPluginManager()->getPlugin("EconomyAPI")->addMoney($playername, $this->config->get("Injured-Add-Coin")); } elseif ($this->config->get("Economy-Plugin") == "PocketMoney") { $this->getServer()->getPluginManager()->getPlugin("PocketMoney")->grantMoney($playername, $this->config->get("Injured-Add-Coin")); } if ($this->config->get("Economy-Plugin") == "EconomyAPI") { $this->getServer()->getPluginManager()->getPlugin("EconomyAPI")->reduceMoney($playername, $this->config->get("Injured-Take-Coin")); } elseif ($this->config->get("Economy-Plugin") == "PocketMoney") { $this->getServer()->getPluginManager()->getPlugin("PocketMoney")->grantMoney($playername, "-" . $this->config->get("Injured-Take-Coin")); } //End } } } }
public function onPlayerDeath(PlayerDeathEvent $event) { $entity = $event->getEntity(); $cause = $entity->getLastDamageCause(); if ($cause instanceof EntityDamageByEntityEvent) { $killer = $cause->getDamager()->getPlayer(); # CustomMessage $Kmessage = str_replace("{Name}", $entity->getPlayer()->getName(), $this->config->get("message-Drop")); $Kmessage = str_replace("{Money}", $this->config->get("money-Drop"), $this->config->get("message-Drop")); $killer->sendMessage("{$Kmessage}"); $Dmessage = str_replace("{Name}", $killer->getPlayer()->getName(), $this->config->get("message-Lost")); $Dmessage = str_replace("{Money}", $this->config->get("money-Lost"), $this->config->get("message-Lost")); $entity > sendMessage("{$Dmessage}"); # Conclusion $this->reduceMoney($entity->getName(), $this->config->get("money-Lost")); $this->grantMoney($killer->getName(), $this->config->get("money-Drop")); return true; } else { return true; } }
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))); } }
/** * @param PlayerDeathEvent $e * @ignoreCancelled true * * @priority MONITOR */ public function onDeath(PlayerDeathEvent $e) { if ($this->getConfig()->get("Death") === true) { $p = $e->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); } } }
/** * @param PlayerDeathEvent $event * @priority high * @ignoreCancelled false */ public function onDeathAndKill(PlayerDeathEvent $event) { $victim = $event->getEntity(); if ($victim->getLastDamageCause() instanceof EntityDamageByEntityEvent) { $attacker = $victim->getLastDamageCause()->getDamager(); if ($attacker instanceof Player) { # There was killer for victim if ($this->owner->isInFaction($victim)) { # Add death for $victim $this->owner->getPlayerFaction($victim)->getPlayers()[$victim->getName()]['stats']['deaths'] += 1; } if ($this->owner->isInFaction($attacker)) { # Add kill for $attacker $this->owner->getPlayerFaction($attacker)->getPlayers()[$attacker->getName()]['stats']['kills'] += 1; } return; } } if ($this->owner->isInFaction($victim)) { # Add death for $victim $this->owner->getPlayerFaction($victim)->getPlayers()[$victim->getName()]['stats']['kills'] += 1; return; } }
public function onDeath(PlayerDeathEvent $event) { $cause = $event->getEntity()->getLastDamageCause(); if ($cause instanceof EntityDamageByEntityEvent) { $player = $event->getEntity(); $killer = $event->getEntity()->getLastDamageCause()->getDamager(); if ($killer instanceof Player) { $imessage = str_replace("@coins", $this->config->get("Money"), $this->config->get("Message")); $message = str_replace("@player", $player->getName(), $imessage); if ($this->config->get("Economy-Plugin") == "Economy") { $this->getServer()->getPluginManager()->getPlugin("EconomyAPI")->addMoney($killer->getName(), $this->config->get("Money")); $killer->sendMessage($message); } elseif ($this->config->get("Economy-Plugin") == "PocketMoney") { $this->getServer()->getPluginManager()->getPlugin("PocketMoney")->grantMoney($killer->getName(), $this->config->get("Money")); $killer->sendMessage($message); } } } }