本文整理汇总了PHP中pocketmine\event\player\PlayerJoinEvent::getPlayer方法的典型用法代码示例。如果您正苦于以下问题:PHP PlayerJoinEvent::getPlayer方法的具体用法?PHP PlayerJoinEvent::getPlayer怎么用?PHP PlayerJoinEvent::getPlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\event\player\PlayerJoinEvent
的用法示例。
在下文中一共展示了PlayerJoinEvent::getPlayer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onJoin
public function onJoin(PlayerJoinEvent $event)
{
$this->sessions[$id = $event->getPlayer()->getId()] = new Session($this, $event->getPlayer());
if ($this->defaultEnable) {
$this->sessions[$id]->enable();
}
}
示例2: onJoin
public function onJoin(PlayerJoinEvent $event)
{
if (!$event->getPlayer() instanceof Player) {
return;
}
$event->getPlayer()->setDataProperty(Entity::DATA_SHOW_NAMETAG, Entity::DATA_TYPE_BYTE, 0);
}
示例3: onJoin
public function onJoin(PlayerJoinEvent $event)
{
$player = $event->getPlayer();
$cfg = $this->plugin->getConfig()->getAll();
if ($cfg["show-join-message"]) {
$player->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["join-message"]));
}
if (ServerAuth::getAPI()->isPlayerAuthenticated($player)) {
//IP Authentication
if ($cfg["IPLogin"]) {
$playerdata = ServerAuth::getAPI()->getPlayerData($player->getName());
if ($playerdata["ip"] == $player->getAddress()) {
ServerAuth::getAPI()->authenticatePlayer($player, $playerdata["password"], false);
$player->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["login"]["ip-login"]));
} else {
ServerAuth::getAPI()->deauthenticatePlayer($event->getPlayer());
}
} else {
ServerAuth::getAPI()->deauthenticatePlayer($event->getPlayer());
}
}
if (!ServerAuth::getAPI()->isPlayerRegistered($player->getName()) && ServerAuth::getAPI()->areRegisterMessagesEnabled()) {
if ($cfg["register"]["password-confirm-required"]) {
$player->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["register"]["message-conf"]));
} else {
$player->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["register"]["message"]));
}
} else {
if (!ServerAuth::getAPI()->isPlayerAuthenticated($player) && ServerAuth::getAPI()->areLoginMessagesEnabled()) {
$player->sendMessage($this->plugin->translateColors("&", $cfg["prefix"] . ServerAuth::getAPI()->getConfigLanguage()->getAll()["login"]["message"]));
}
}
}
示例4: onPlayerJoin
public function onPlayerJoin(PlayerJoinEvent $event)
{
$player = $event->getPlayer();
if ($player instanceof Player) {
$this->plugin->petOwnerRegister($player, $event->getPlayer()->getPosition()->getLevel()->getName());
}
}
示例5: onJoin
public function onJoin(PlayerJoinEvent $event)
{
$x = $this->plugin->getServer()->getDefaultLevel()->getSafeSpawn()->getX();
$y = $this->plugin->getServer()->getDefaultLevel()->getSafeSpawn()->getY();
$z = $this->plugin->getServer()->getDefaultLevel()->getSafeSpawn()->getZ();
$event->getPlayer()->teleport($event->getPlayer()->getLevel()->getSafeSpawn());
$this->debug->onDebug('Zum Start teleportiert');
}
示例6: join
public function join(pje $e)
{
if ($this->isStart()) {
$this->setOni($e->getPlayer());
} else {
$this->setHuman($e->getPlayer());
}
}
示例7: onPlayerJoin
public function onPlayerJoin(PlayerJoinEvent $event)
{
foreach ($this->npc as $npc) {
if ($npc->getLevel()->getFolderName() === $event->getPlayer()->getLevel()->getFolderName()) {
$npc->spawnTo($event->getPlayer());
}
}
}
示例8: onPlayerJoin
public function onPlayerJoin(PlayerJoinEvent $event)
{
if (isset($this->pendingPlayers[$event->getPlayer()->getName()])) {
$fetch = new CommandFetchTask($this->getOwner(), ["users" => [$event->getPlayer()->getName()], "offlineCommands" => false]);
$fetch->call();
unset($this->pendingPlayers[$event->getPlayer()->getName()]);
}
}
示例9: onJoin
public function onJoin(PlayerJoinEvent $event)
{
if (isset($this->db["IP"][$event->getPlayer()->getAddress()])) {
$this->message($event->getPlayer(), "자동 로그인 되었습니다 ! (IP로그인)");
return;
} else {
$this->deauthenticatePlayer($player);
}
}
示例10: onJoin
public function onJoin(PlayerJoinEvent $ev)
{
if (!file_exists($this->getDataFolder() . "players/" . $ev->getPlayer()->getName() . ".yml")) {
$config = new Config($this->getDataFolder() . "players/" . strtolower($ev->getPlayer()->getName()) . ".yml", Config::YAML);
$config->set("friends", array());
$config->save();
echo "made config for " . $ev->getPlayer()->getName();
}
}
示例11: onJoin
public function onJoin(PlayerJoinEvent $event)
{
$spawn = $this->plugin->getNextSpawn();
$event->getPlayer()->teleport($spawn);
$this->plugin->players = $this->plugin->players + 1;
$event->setJoinMessage("[HG] " . $event->getPlayer()->getName() . " joined the match!");
if (!$this->plugin->points->exists($event->getPlayer()->getName())) {
$this->plugin->points->set($event->getPlayer()->getName(), array("kills" => 0, "deaths" => 0));
}
}
示例12: onPlayerJoin
public function onPlayerJoin(PlayerJoinEvent $event)
{
$this->plugin->log("[HG] StatueListener: onPlayerJoin for player " . $event->getPlayer()->getName());
$player = $event->getPlayer();
if (!isset($this->plugin->getStatueManager()->npcsSpawns[$player->getName()])) {
$this->plugin->getStatueManager->npcsSpawns[$player->getName()] = $player->getName();
$builder = new StatueBuilder($this->plugin);
$builder->displayStatues($player, $this->plugin->statueManager->npcs);
}
}
示例13: onPlayerJoin
public function onPlayerJoin(PlayerJoinEvent $event)
{
$this->getServer()->getScheduler()->scheduleRepeatingTask(new Task($this, $this->cfg->get("duration")), 10);
$type = $this->cfg->get("type");
$message = $this->cfg->get("message");
if ($type == "tip") {
$event->getPlayer()->sendTip($message);
} elseif ($type == "popup") {
$event->getPlayer()->sendPopup($message);
}
}
示例14: onPlayerJoin
/**
* @param PlayerJoinEvent $event
*
* @priority LOWEST
*/
public function onPlayerJoin(PlayerJoinEvent $event)
{
if ($this->plugin->getConfig()->get("authenticateByLastUniqueId") === true and $event->getPlayer()->hasPermission("simpleauth.lastid")) {
$config = $this->plugin->getDataProvider()->getPlayer($event->getPlayer());
if ($config !== null and $config["lastip"] === $event->getPlayer()->getUniqueId()->toString()) {
$this->plugin->authenticatePlayer($event->getPlayer());
return;
}
}
$this->plugin->deauthenticatePlayer($event->getPlayer());
}
示例15: onJoinEvent
public function onJoinEvent(PlayerJoinEvent $event)
{
$config = $this->getConfig();
foreach ($this->getServer()->getOnlinePlayers() as $players) {
$playerName = $event->getPlayer()->getName();
$msg2 = $config->get("Announce-Join");
$msg2 = str_replace("{PLAYER}", $playerName, $msg2);
$msg = $config->get("Message-Join");
$msg = str_replace("{PLAYER}", $playerName, $msg);
$p = $event->getPlayer();
$players->sendTip($msg2);
$p->sendTip($msg);
}
}