本文整理汇总了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');
}
示例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"])));
}
}
}
示例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}");
}
}
示例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);
}
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
示例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());
}
}
}
示例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()));
}
}
示例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());
}
示例11: onRespawn
public function onRespawn(PlayerRespawnEvent $event, Session $session)
{
$event->setRespawnPosition(Settings::parkour_checkpoint_startPos($this->data[$session->getUID()]->getProgress(), $session->getMain()->getServer()));
}
示例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'])));
}
}
示例13: onRespawn
public function onRespawn(PlayerRespawnEvent $event)
{
$event->getPlayer()->getInventory()->clearAll();
$pos = $this->getServer()->getDefaultLevel()->getSafeSpawn();
$event->setRespawnPosition($pos);
}
示例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]);
}
示例15: onRespawn
public function onRespawn(PlayerRespawnEvent $event)
{
$event->setRespawnPosition($this->respawnPosition);
}