本文整理汇总了PHP中pocketmine\event\player\PlayerRespawnEvent::getPlayer方法的典型用法代码示例。如果您正苦于以下问题:PHP PlayerRespawnEvent::getPlayer方法的具体用法?PHP PlayerRespawnEvent::getPlayer怎么用?PHP PlayerRespawnEvent::getPlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\event\player\PlayerRespawnEvent
的用法示例。
在下文中一共展示了PlayerRespawnEvent::getPlayer方法的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()]);
}
}
示例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: 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();
}
}
示例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));
}
}
示例5: onPlayerRespawn
public function onPlayerRespawn(PlayerRespawnEvent $event)
{
$player = $event->getPlayer();
if ($player instanceof Player) {
$this->plugin->petOwnerRegister($player, $event->getRespawnPosition()->getLevel()->getName());
}
}
示例6: 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));
}
示例7: 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);
}
}
示例8: 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
示例9: 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);
}
}
示例10: 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));
}
示例11: 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());
}
}
示例12: 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);
}
示例13: 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}");
}
}
示例14: 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);
}
}
}
}
示例15: playerSpawn
public function playerSpawn(PlayerRespawnEvent $event)
{
$player = $event->getPlayer();
$authorized = "denied";
if ($this->SignShop->getSetup()->get("signCreated") == "admin" && $player->isOp()) {
$authorized = "allow";
}
if ($this->SignShop->getSetup()->get("signCreated") == "all") {
$authorized = "allow";
}
if ($this->SignShop->getProvider()->existsPlayer($player->getName())) {
$get = $this->SignShop->getProvider()->getPlayer($player->getName());
if ($get["changed"] < $this->SignShop->getSetup()->get("lastChanged")) {
$get["authorized"] = $authorized;
$get["changed"] = time();
$this->SignShop->getProvider()->setPlayer($player->getName(), $get);
}
} else {
$this->SignShop->getProvider()->setPlayer($player->getName(), ["authorized" => $authorized, "changed" => time(), "echo" => true]);
}
}