本文整理汇总了PHP中pocketmine\event\player\PlayerDeathEvent类的典型用法代码示例。如果您正苦于以下问题:PHP PlayerDeathEvent类的具体用法?PHP PlayerDeathEvent怎么用?PHP PlayerDeathEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PlayerDeathEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onPlayerDeath
/**
* @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());
}
示例2: onDeath
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();
}
}
}
}
示例3: onDeath
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)));
}
}
示例4: onDeath
public function onDeath(PlayerDeathEvent $event)
{
$player = $event->getEntity();
if ($this->plugin->isActive($player)) {
$this->plugin->removeActive($player);
}
}
示例5: onDeath
public function onDeath(PlayerDeathEvent $event)
{
$player = $event->getEntity();
if (Main::isActive($player)) {
Main::removeActive($player);
}
}
示例6: onPlayerDeathEvent
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);
}
}
}
}
示例7: onDeath
public function onDeath(PlayerDeathEvent $event)
{
$cfg = $this->getConfig();
$enable = $cfg->get("enable");
if ($event->getEntity() instanceof Player and $enable !== true) {
$event->setDrops([]);
}
}
示例8: onDeath
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()]);
}
示例9: onDeath
public function onDeath(PlayerDeathEvent $event)
{
if (!$this->killedByBlock) {
return;
}
$this->killedByBlock = false;
$event->setDeathMessage(null);
$this->getServer()->broadcastMessage($this->getCustomMessage($event->getEntity()));
}
示例10: onDeath
public function onDeath(PlayerDeathEvent $event)
{
foreach ($this->tntRun->arenas as $arena) {
if ($arena->getPlayerManager()->isPlaying($event->getEntity())) {
$arena->getPlayerHandler()->leavePlayer($event->getEntity());
return;
}
}
}
示例11: onPlayerDeathEvent
public function onPlayerDeathEvent(PlayerDeathEvent $event)
{
$message = $event->getDeathMessage();
if ($message instanceof TranslationContainer) {
$message = $this->getServer()->getLanguage()->translateString($message->getText(), $message->getParameters());
}
AnnounceSystem::getInstance()->pushBroadCastPopup($message, 2);
$event->setDeathMessage(null);
}
示例12: onDeath
/**
* @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));
}
}
示例13: onPlayerDeath
public function onPlayerDeath(PlayerDeathEvent $event)
{
$deadPlayer = $event->getEntity();
$arena = $this->arenaManager->getPlayerArena($deadPlayer);
if ($arena != NULL) {
$event->setDrops([]);
$event->setKeepInventory(false);
$arena->onPlayerDeath($deadPlayer);
}
}
示例14: onPlayerDeath
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);
}
示例15: onDeath
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");
}
}
}