當前位置: 首頁>>代碼示例>>PHP>>正文


PHP player\PlayerRespawnEvent類代碼示例

本文整理匯總了PHP中pocketmine\event\player\PlayerRespawnEvent的典型用法代碼示例。如果您正苦於以下問題:PHP PlayerRespawnEvent類的具體用法?PHP PlayerRespawnEvent怎麽用?PHP PlayerRespawnEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了PlayerRespawnEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: onPlayerRespawn

 public function onPlayerRespawn(PlayerRespawnEvent $event)
 {
     //TODO send kit info
     if (isset($this->players[$event->getPlayer()->getName()])) {
         unset($this->players[$event->getPlayer()->getName()]);
     }
 }
開發者ID:haruajsuru,項目名稱:BattleKits,代碼行數:7,代碼來源:KitHistoryStore.php

示例2: onRespawn

 public function onRespawn(PlayerRespawnEvent $e)
 {
     $cfg = $this->getConfig();
     $player = $e->getPlayer();
     $player->getInventory()->setItem(25, Item::get($cfg->get("HidePlayers-Item"), 0, 1));
     $player->getInventory()->setItem(26, Item::get($cfg->get("ShowPlayers-Item"), 0, 1));
 }
開發者ID:TonyDroidd,項目名稱:HideAllPlayers,代碼行數:7,代碼來源:Main.php

示例3: onPlayerRespawn

 public function onPlayerRespawn(PlayerRespawnEvent $event)
 {
     $player = $event->getPlayer();
     if ($player instanceof Player) {
         $this->plugin->petOwnerRegister($player, $event->getRespawnPosition()->getLevel()->getName());
     }
 }
開發者ID:flaxues,項目名稱:BuddyPets,代碼行數:7,代碼來源:EventListener.php

示例4: onPlayerRespawned

 public function onPlayerRespawned(PlayerRespawnEvent $event)
 {
     $p = $event->getPlayer();
     $level = $p->getLevel();
     $light = new AddEntityPacket();
     $light->type = 93;
     $light->eid = Entity::$entityCount++;
     $light->metadata = array();
     $light->speedX = 9;
     $light->speedY = 0;
     $light->speedZ = -9;
     $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);
         $pl->addEffect(Effect::getEffect(Effect::SPEED)->setAmplifier(3)->setDuration(30000));
         $pl->setGamemode(2);
         $pl->getInventory()->addItem(new Item(Item::COOKIE, 0, 64));
         $pl->getInventory()->addItem(new Item(Item::SLIMEBALL, 0, 1));
         $pl->getInventory()->addItem(new Item(Item::COAL, 0, 1));
         $pl->getInventory()->addItem(new Item(Item::GUNPOWDER, 0, 1));
     }
 }
開發者ID:Pab450,項目名稱:SkyWorld_Server,代碼行數:26,代碼來源:Plugin.php

示例5: onRespawn

 public function onRespawn(PlayerRespawnEvent $event)
 {
     $x = $this->plugin->getServer()->getDefaultLevel()->getSafeSpawn()->getX();
     $y = $this->plugin->getServer()->getDefaultLevel()->getSafeSpawn()->getY();
     $z = $this->plugin->getServer()->getDefaultLevel()->getSafeSpawn()->getZ();
     $event->setRespawnPosition(new Position($x, $y, $z));
     $this->debug->onDebug('Zum Start respawnt');
 }
開發者ID:LittleBigMC,項目名稱:Minecraft-Pocket-Edition,代碼行數:8,代碼來源:allwaysonspawn.php

示例6: onRespawn

 public function onRespawn(PlayerRespawnEvent $event)
 {
     $cg = $this->getConfig();
     $enablerecieveafterdeath = $cg->get("Enable-Receive-After-Death");
     if ($enablerecieveafterdeath == true) {
         $p = $event->getPlayer();
         $this->getServer()->getScheduler()->scheduleDelayedTask(new FineTask([$this, "Receive"], [$p]), 0);
     }
 }
開發者ID:GoneTone,項目名稱:Chinese-Traditional-Translations-For-PocketMine-MP-Plugins,代碼行數:9,代碼來源:FineJoinEffects.php

示例7: checkRespawn

 public function checkRespawn(PlayerRespawnEvent $event)
 {
     $player = $event->getPlayer();
     foreach ($player->getInventory()->getContents() as $item) {
         if ($item->getID() == Item::CRAFTING_TABLE) {
             return;
         }
     }
     $player->getInventory()->addItem(Item::get(Item::CRAFTING_TABLE));
 }
開發者ID:EmreTr1,項目名稱:rtr,代碼行數:10,代碼來源:FreeCraftingTable.php

示例8: onPlayerRespawn

 /**
  *
  * @param PlayerRespawnEvent $event        	
  *
  *
  */
 public function onPlayerRespawn(PlayerRespawnEvent $event)
 {
     $this->plugin->log("[HG] StatueListener: onPlayerRespawn for player " . $event->getPlayer()->getName());
     $player = $event->getPlayer();
     if (!isset($this->plugin->getStatueManager()->npcsSpawns[$player->getName()])) {
         $builder = new StatueBuilder($this->plugin);
         $builder->displayStatues($player, $this->plugin->statueManager->npcs);
         // $this->builder->spawnHallOfFrameWinners ();
         $this->plugin->getStatueManager->npcsSpawns[$player->getName()] = $player->getName();
     }
 }
開發者ID:robozeri,項目名稱:SG,代碼行數:17,代碼來源:StatueListener.php

示例9: onPlayerRespawn

 public function onPlayerRespawn(PlayerRespawnEvent $event)
 {
     if ($this->plugin->hasPlayedBefore($event->getPlayer()) && $this->plugin->isJailed($event->getPlayer())) {
         $t = $this->getPlugin()->data->getAll();
         $j = $this->getPlugin()->data2->getAll();
         $jail = $t[$event->getPlayer()->getName()]["jail"];
         if ($this->getPlugin()->jailExists($jail)) {
             $event->setRespawnPosition(new Position($j[$jail]["x"], $j[$jail]["y"], $j[$jail]["z"], $this->getPlugin()->getServer()->getLevelByName($j[$jail]["world"])));
         }
     }
 }
開發者ID:HerO-0110,項目名稱:Jail,代碼行數:11,代碼來源:PlayerListener.php

示例10: onPlayerRespawn

 public function onPlayerRespawn(PlayerRespawnEvent $event)
 {
     $isMoveRequired = true;
     foreach (self::$respawnableGames as $game) {
         if ($game->isPlayerPlaying($event->getPlayer()->getName())) {
             $isMoveRequired = false;
             break;
         }
     }
     if ($isMoveRequired) {
         $event->setRespawnPosition(Server::getInstance()->getDefaultLevel()->getSpawnLocation());
     }
 }
開發者ID:organization,項目名稱:GameCoreFramework,代碼行數:13,代碼來源:GCFramework.php

示例11: onRespawn

 public function onRespawn(PlayerRespawnEvent $ent)
 {
     $player = $ent->getPlayer();
     $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);
 }
開發者ID:NikoTBC,項目名稱:LightningEvents,代碼行數:15,代碼來源:LightningEvents.php

示例12: onRespawn

 public function onRespawn(PlayerRespawnEvent $event)
 {
     $player = $event->getPlayer();
     $name = $player->getName();
     $coordinate = $this->temp->getNested("{$name}");
     if (!isset($coordinate)) {
         return;
     } else {
         $targetWorld = $this->getServer()->getLevelByName($coordinate);
         $spawn = $targetWorld->getSpawnLocation();
         $x = $spawn->getX();
         $y = $spawn->getY();
         $z = $spawn->getZ();
         $event->setRespawnPosition($spawn);
         $this->temp->remove("{$name}");
     }
 }
開發者ID:HerO-0110,項目名稱:PerWorldDeath,代碼行數:17,代碼來源:PerWorldDeath.php

示例13: onDeath

 /**
  * @priority high
  */
 public function onDeath(PlayerRespawnEvent $event)
 {
     $level = $event->getPlayer()->getLevel();
     $pillarPos = new Position($event->getPlayer()->x, $event->getPlayer()->y, $event->getPlayer()->z, $level);
     for ($h = 1; $h <= 30; $h++) {
         $pillarPos->setComponents($pillarPos->x, ++$pillarPos->y, $pillarPos->z);
         $level->addParticle(new RedstoneParticle($pillarPos, 10));
     }
     $pillarPos->setComponents($pillarPos->x, $pillarPos->y - 10, $pillarPos->z);
     $headPos = new Position($pillarPos->x, $pillarPos->y, $pillarPos->z, $level);
     for ($r = -5; $r <= 5; $r++) {
         $headPos->setComponents($pillarPos->x + $r, $pillarPos->y, $pillarPos->z);
         $level->addParticle(new ExplodeParticle($headPos));
         $p = new RedstoneParticle($headPos, 10);
         $level->addParticle($p);
     }
 }
開發者ID:nesgohood,項目名稱:PMMP-Plugins,代碼行數:20,代碼來源:deadMarker.php

示例14: onPlayerRespawn

 public function onPlayerRespawn(PlayerRespawnEvent $event)
 {
     $name = $event->getPlayer()->getName();
     $p = $event->getPlayer();
     $worldname = $this->config->get("Respawnworld");
     if ($reason == "disconnectionScreen.serverFull") {
         $pl = $event->getPlayer();
         $addr1 = $this->config->get("IP");
         $addr2 = $this->config->get("Port");
         $ft = $this->getServer()->getPluginManager()->getPlugin("FastTransfer");
         if (!$ft) {
             $this->getLogger()->info("FAST TRANSFER NOT INSTALLED");
             return;
         }
         $this->getLogger()->info(MT::YELLOW . "{$name} transfer to {$addr1} {$addr2}");
         $ft->transferPlayer($pl, $addr1, $addr2);
         $event->setCancelled(true);
     }
 }
開發者ID:100henrik100,項目名稱:Minecraft-Pocket-Edition,代碼行數:19,代碼來源:respawnback.php

示例15: onPlayerRespawn

 public function onPlayerRespawn(PlayerRespawnEvent $event)
 {
     $this->cfg = $this->plugin->getConfig()->getAll();
     $player = $event->getPlayer();
     //Check if the victim is a Player
     if ($player instanceof Player) {
         //Teleport Player on Death: 1 = Teleport to spawn 2 = Teleport to Hub
         if ($this->cfg["teleport-on-death"] == 1) {
             //Check if spawn exists
             if ($this->plugin->SpawnExists($player->getLevel())) {
                 $pos = $this->plugin->getSpawn($player->getLevel());
                 $event->setRespawnPosition(new Position($pos["X"], $pos["Y"], $pos["Z"]), $pos["Yaw"], $pos["Pitch"]);
             }
         } elseif ($this->cfg["teleport-on-death"] == 2) {
             //Check if hub exists
             if ($this->plugin->HubExists()) {
                 $this->plugin->teleportToHub($player);
             }
         }
     }
 }
開發者ID:xHFx,項目名稱:MSpawns,代碼行數:21,代碼來源:EventListener.php


注:本文中的pocketmine\event\player\PlayerRespawnEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。