当前位置: 首页>>代码示例>>PHP>>正文


PHP PlayerRespawnEvent::setRespawnPosition方法代码示例

本文整理汇总了PHP中pocketmine\event\player\PlayerRespawnEvent::setRespawnPosition方法的典型用法代码示例。如果您正苦于以下问题:PHP PlayerRespawnEvent::setRespawnPosition方法的具体用法?PHP PlayerRespawnEvent::setRespawnPosition怎么用?PHP PlayerRespawnEvent::setRespawnPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\event\player\PlayerRespawnEvent的用法示例。


在下文中一共展示了PlayerRespawnEvent::setRespawnPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: onRespawn

 public function onRespawn(PlayerRespawnEvent $event)
 {
     $player = $event->getPlayer();
     if ($this->isOtu($player->getName()) or $this->isRuna($player->getName())) {
         if ($this->isAutoRespawnInJail()) {
             $respawn = $event->getRespawnPosition();
             if (!(($pos = $this->getRespawnPosition($player->getName())) === false)) {
                 //todo 関数名が紛らわしいので後で変更
                 $respawn = $pos;
             }
             $event->setRespawnPosition($respawn);
         }
     }
 }
开发者ID:MrDoni98,项目名称:PocketMine-MP-Plugins,代码行数:14,代码来源:MainClass.php

示例6: onPlayerRespawn

 public function onPlayerRespawn(PlayerRespawnEvent $event)
 {
     if (isset(self::$players[$event->getPlayer()->getName()])) {
         $xcelPlayer = self::$players[$event->getPlayer()->getName()];
         $event->setRespawnPosition($this->getServer()->getDefaultLevel()->getSpawnLocation());
         if ($xcelPlayer->getGame() !== null) {
             $xcelPlayer->getGame()->onPlayerMoveToAnotherWorld($xcelPlayer);
         }
     }
 }
开发者ID:organization,项目名称:XcelNgien,代码行数:10,代码来源:XcelNgien.php

示例7: onPlayerRespawn

 public function onPlayerRespawn(PlayerRespawnEvent $event)
 {
     $player = $event->getPlayer();
     if ($this->config->exists("lastpos")) {
         if ($player->getLevel()->getFolderName() == $this->level->getFolderName()) {
             $v3 = $this->signlevel->getSpawnLocation();
             $event->setRespawnPosition(new Position($v3->x, $v3->y, $v3->z, $this->signlevel));
         }
     }
     unset($event, $player);
 }
开发者ID:LittleBigMC,项目名称:SurvivalGames,代码行数:11,代码来源:Main.php

示例8: onRespawn

 public function onRespawn(PlayerRespawnEvent $event)
 {
     $player = $event->getPlayer();
     $name = $player->getName();
     if ($this->inArena($player)) {
         $arena = $this->getArena($player);
         $config = new Config($this->getDataFolder() . "Arenas/" . $arena . ".yml", Config::YAML);
         $team = $this->getTeam($player->getNameTag());
         if ($config->getNested("Bed." . $team . ".Alive") == true) {
             $welt = $config->getNested("Spawn." . $team . ".Welt");
             $x = $config->getNested("Spawn." . $team . ".X");
             $y = $config->getNested("Spawn." . $team . ".Y");
             $z = $config->getNested("Spawn." . $team . ".Z");
             $level = $this->getServer()->getLevelByName($welt);
             $event->setRespawnPosition(new Position($x, $y, $z, $level));
         } else {
             $event->setRespawnPosition($this->getServer()->getDefaultLevel()->getSafeSpawn());
             $player->sendMessage($this->prefix . TextFormat::RED . "Dein Bett wurde zerstört, du kannst nicht mehr respawnen!");
             $this->removePlayerFromArena($arena, $name);
             $this->lasthit[$player->getName()] = "no";
             $player->setNameTag($player->getName());
         }
     }
 }
开发者ID:Bluplayz,项目名称:BedwarsPE,代码行数:24,代码来源:Bedwars.php

示例9: onPlayerRespawned

 public function onPlayerRespawned(PlayerRespawnEvent $event)
 {
     if (isset($this->players[$event->getPlayer()->getName()]) && $this->players[$event->getPlayer()->getName()] !== "NONE") {
         $event->setRespawnPosition(new Position($this->config["spawnpos"]["x"], $this->config["spawnpos"]["y"], $this->config["spawnpos"]["z"], $event->getPlayer()->getLevel()));
     }
 }
开发者ID:EpicArtz08999,项目名称:ZombieGame,代码行数:6,代码来源:GameGenius.php

示例10: onPlayerRespawn

 public function onPlayerRespawn(PlayerRespawnEvent $event)
 {
     if (isset($this->players[$event->getPlayer()->getName()])) {
         if (($manager = $this->getWorldManagerByPlayerName($event->getPlayer()->getName())) !== null && $manager->hasPlayer($event->getPlayer()->getName())) {
             $this->getWorldManagerByPlayerName($event->getPlayer()->getName())->onPlayerMoveToAnotherWorld($event->getPlayer(), $this->getServer()->getDefaultLevel()->getFolderName());
         }
     }
     foreach ($this->npcs as $npc) {
         if ($npc->getLevel()->getFolderName() === $this->getServer()->getDefaultLevel()->getFolderName()) {
             $npc->spawnTo($event->getPlayer());
         }
     }
     $event->setRespawnPosition($this->getServer()->getDefaultLevel()->getSpawnLocation());
 }
开发者ID:HelloWorld017,项目名称:SkyFall,代码行数:14,代码来源:FreedomDive.php

示例11: onRespawn

 public function onRespawn(PlayerRespawnEvent $event, Session $session)
 {
     $event->setRespawnPosition(Settings::parkour_checkpoint_startPos($this->data[$session->getUID()]->getProgress(), $session->getMain()->getServer()));
 }
开发者ID:LegionPE,项目名称:LegionPE-Eta,代码行数:4,代码来源:ParkourGame.php

示例12: onRespawn

 public function onRespawn(PlayerRespawnEvent $e)
 {
     $p = $e->getPlayer();
     if ($this->getPlayerMode($p) === 0) {
         $e->setRespawnPosition(new Position($this->data['arena']['lobby_position_x'], $this->data['arena']['lobby_position_y'], $this->data['arena']['lobby_position_z'], $this->plugin->getServer()->getLevelByName($this->data['arena']['arena_world'])));
         return;
     }
     if ($this->getPlayerMode($p) === 1) {
         if ($this->data['arena']['spectator_mode'] == 'true') {
             $e->setRespawnPosition(new Position($this->data['arena']['spec_spawn_x'], $this->data['arena']['spec_spawn_y'], $this->data['arena']['spec_spawn_z'], $this->plugin->getServer()->getLevelByName($this->data['arena']['arena_world'])));
             unset($this->ingamep[strtolower($p->getName())]);
             $this->spec[strtolower($p->getName())] = $p;
             return;
         }
         unset($this->ingamep[strtolower($p->getName())]);
         $e->setRespawnPosition(new Position($this->data['arena']['leave_position_x'], $this->data['arena']['leave_position_y'], $this->data['arena']['leave_position_z'], $this->plugin->getServer()->getLevelByName($this->data['arena']['leave_position_world'])));
         return;
     }
     if ($this->getPlayerMode($p) === 2) {
         //$p->sendChunk($this->data['arena']['spec_spawn_x'], $this->data['arena']['spec_spawn_z']);
         $e->setRespawnPosition(new Position($this->data['arena']['spec_spawn_x'], $this->data['arena']['spec_spawn_y'], $this->data['arena']['spec_spawn_z'], $this->plugin->getServer()->getLevelByName($this->data['arena']['arena_world'])));
     }
 }
开发者ID:Creeperface01,项目名称:ColorMatch,代码行数:23,代码来源:Arena.php

示例13: onRespawn

 public function onRespawn(PlayerRespawnEvent $event)
 {
     $event->getPlayer()->getInventory()->clearAll();
     $pos = $this->getServer()->getDefaultLevel()->getSafeSpawn();
     $event->setRespawnPosition($pos);
 }
开发者ID:100henrik100,项目名称:Minecraft-Pocket-Edition,代码行数:6,代码来源:minigame.php

示例14: onRespawn

 public function onRespawn(PlayerRespawnEvent $event)
 {
     $welt = $event->getPlayer()->getLevel()->getName();
     if ($this->cfg->get("JumpandRunWelt") != $welt) {
         return;
     }
     $name = $event->getPlayer()->getName();
     if (isset($this->tot[$name])) {
     }
     if (isset($this->coords[$name])) {
         $pos = $this->coords[$name];
         $pos1 = explode(",", $pos);
         $event->setRespawnPosition(new Position($pos1[0], $pos1[1], $pos1[2]));
         $this->tot[$name] = $name;
         return;
     }
     $x = $this->getServer()->getDefaultLevel()->getSafeSpawn()->getX();
     $y = $this->getServer()->getDefaultLevel()->getSafeSpawn()->getY();
     $z = $this->getServer()->getDefaultLevel()->getSafeSpawn()->getZ();
     $event->setRespawnPosition(new Position($x, $y, $z));
     unset($this->tot[$name]);
 }
开发者ID:LittleBigMC,项目名称:Minecraft-Pocket-Edition,代码行数:22,代码来源:jumpnrun.php

示例15: onRespawn

 public function onRespawn(PlayerRespawnEvent $event)
 {
     $event->setRespawnPosition($this->respawnPosition);
 }
开发者ID:HgHeroes,项目名称:PocketMine-Plugin-Tutorials,代码行数:4,代码来源:Main.php


注:本文中的pocketmine\event\player\PlayerRespawnEvent::setRespawnPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。