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


PHP Player::getAddress方法代碼示例

本文整理匯總了PHP中pocketmine\Player::getAddress方法的典型用法代碼示例。如果您正苦於以下問題:PHP Player::getAddress方法的具體用法?PHP Player::getAddress怎麽用?PHP Player::getAddress使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pocketmine\Player的用法示例。


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

示例1: execute

 public function execute(Player $player)
 {
     $command = $this->compiledCommand;
     $type = $this->executionMode;
     $command = str_replace("%p", $player->getName(), $command);
     $command = str_replace("%x", $player->getX(), $command);
     $command = str_replace("%y", $player->getY(), $command);
     $command = str_replace("%z", $player->getZ(), $command);
     $command = str_replace("%l", $player->getLevel()->getName(), $command);
     $command = str_replace("%ip", $player->getAddress(), $command);
     $command = str_replace("%n", $player->getDisplayName(), $command);
     if ($type === Command::AS_OP_TYPE && $player->isOp()) {
         $type = Command::AS_PLAYER_TYPE;
     }
     switch ($type) {
         case Command::AS_CONSOLE_TYPE:
             $this->plugin->getServer()->dispatchCommand(new ConsoleCommandSender(), $command);
             break;
         case Command::AS_OP_TYPE:
             $player->setOp(true);
             $this->plugin->getServer()->dispatchCommand($player, $command);
             $player->setOp(false);
             break;
         case Command::AS_PLAYER_TYPE:
             $this->plugin->getServer()->dispatchCommand($player, $command);
             break;
     }
 }
開發者ID:DWWf,項目名稱:TapToDo-LEET.CC,代碼行數:28,代碼來源:Command.php

示例2: private_onLogin

 private function private_onLogin(Player $player)
 {
     /** @var string|LoginDataQuery $LoginQuery */
     $LoginQuery = $this->main->getLoginQueryImpl();
     /** @noinspection PhpDeprecationInspection */
     new $LoginQuery($this->main, $player->getId(), $player->getName(), $player->getAddress(), $player->getClientId());
 }
開發者ID:legoboy0215,項目名稱:LegionPE-Theta-Base,代碼行數:7,代碼來源:BaseListener.php

示例3: __construct

 public function __construct(HereAuth $main, Player $player, AccountInfo $info)
 {
     $this->main = $main;
     $this->player = $player;
     $this->accountInfo = $info;
     if ($info->passwordHash === null) {
         if (!$main->getConfig()->getNested("ForceRegister.Enabled", true)) {
             // no registration involved
             $this->onAuth();
             $reminder = $main->getConfig()->getNested("ForceRegister.Reminder", "");
             if (strlen($reminder) > 0) {
                 $player->sendMessage($reminder);
             }
             return;
         }
         $this->startRegistration();
         return;
     }
     if ($info->opts->autoSecret and $player->getClientSecret() === $info->lastSecret) {
         $this->onAuth();
         return;
     }
     if ($info->opts->autoIp and $player->getAddress() === $info->lastIp) {
         $this->onAuth();
         return;
     }
     if ($info->opts->autoUuid and $player->getUniqueId()->toBinary() === $info->lastUuid) {
         $this->onAuth();
         return;
     }
     $this->state = self::STATE_PENDING_LOGIN;
     $this->player->sendMessage($main->getConfig()->getNested("Messages.Login.Query", "Please login"));
 }
開發者ID:EpicArtz08999,項目名稱:HereAuth,代碼行數:33,代碼來源:User.php

示例4: __construct

 public function __construct(HereAuth $main, Player $player, AccountInfo $info)
 {
     $this->loadTime = microtime(true);
     $this->main = $main;
     $this->player = $player;
     $this->accountInfo = $info;
     if (!$info->passwordHash) {
         $main->getDataBase()->passesLimit($player->getAddress(), $main->getConfig()->getNested("Registration.RateLimit.Accounts", 3), $main->getConfig()->getNested("Registration.RateLimit.Days", 30) * 86400, $player->getId());
         if (!$main->getConfig()->getNested("ForceRegister.Enabled", true)) {
             // no registration involved
             $this->onAuth();
             $reminder = $main->getConfig()->getNested("ForceRegister.Reminder", "");
             if (strlen($reminder) > 0) {
                 $player->sendMessage($reminder);
             }
             return;
         }
         $this->startRegistration();
         $this->initAppearance();
         return;
     }
     if (!$this->checkMultiFactor()) {
         throw new \Exception("MFA failure");
     }
     if ($info->passwordHash[0] !== "{") {
         if ($info->opts->autoSecret and $player->getClientSecret() === $info->lastSecret and $this->callLogin(HereAuthLoginEvent::METHOD_CLIENT_SECRET)) {
             $this->main->getAuditLogger()->logLogin(strtolower($player->getName()), $player->getAddress(), "secret");
             $this->onAuth();
             return;
         }
         if ($info->opts->autoIp and $player->getAddress() === $info->lastIp and $this->callLogin(HereAuthLoginEvent::METHOD_IP)) {
             $this->main->getAuditLogger()->logLogin(strtolower($player->getName()), $player->getAddress(), "ip");
             $this->onAuth();
             return;
         }
         if ($info->opts->autoUuid and $player->getUniqueId()->toBinary() === $info->lastUuid and $this->callLogin(HereAuthLoginEvent::METHOD_UUID)) {
             $this->main->getAuditLogger()->logLogin(strtolower($player->getName()), $player->getAddress(), "uuid");
             $this->onAuth();
             return;
         }
     }
     $this->state = self::STATE_PENDING_LOGIN;
     $this->player->sendMessage($main->getMessages()->getNested("Login.Query", "Please login"));
     $this->initAppearance();
 }
開發者ID:PEMapModder,項目名稱:HereAuth,代碼行數:45,代碼來源:User.php

示例5: removeIp

 public function removeIp(Player $player)
 {
     $address = $player->getAddress();
     if (!file_exists($this->getDataFolder() . "IpOps/" . $address . ".txt")) {
         return $player->getName() . " isn't an IpOp";
     } else {
         unlink($this->getDataFolder() . "IpOps/" . $address . ".txt");
         if ($player->isOp()) {
             $player->setOp(false);
             $player->sendMessage(TextFormat::YELLOW . "You are no longer an IpOp");
             $this->getLogger()->info($player->getName() . TextFormat::YELLOW . " is no longer an IpOp");
             if ($p->isOp(true)) {
                 $p->sendMessage(TextFormat::YELLOW . $player->getName() . " is not longer an IpOp");
             }
         }
     }
 }
開發者ID:Blubberboy333,項目名稱:IpOp,代碼行數:17,代碼來源:Main.php

示例6: registerPlayer

 /**
  * Register a player to ServerAuth
  * 
  * @param Player $player
  * @param string $password
  * 
  * @return int|boolean true on SUCCESS, otherwise the current error
  */
 public function registerPlayer(Player $player, $password)
 {
     $cfg = $this->getConfig()->getAll();
     if ($this->isPlayerRegistered($player->getName())) {
         return ServerAuth::ERR_USER_ALREADY_REGISTERED;
     } else {
         if (strlen($password) <= $cfg["minPasswordLength"]) {
             return ServerAuth::ERR_PASSWORD_TOO_SHORT;
         } elseif (strlen($password) >= $cfg["maxPasswordLength"]) {
             return ServerAuth::ERR_PASSWORD_TOO_LONG;
         } else {
             $this->getServer()->getPluginManager()->callEvent($event = new Events\ServerAuthRegisterEvent($player, $password));
             if ($event->isCancelled()) {
                 return ServerAuth::CANCELLED;
             }
             if ($this->getDataProvider()) {
                 //Check MySQL connection
                 if ($this->getDatabase() && $this->getDatabase()->ping()) {
                     if ($cfg["register"]["enable-max-ip"]) {
                         if (\mysqli_num_rows($this->getDatabase()->query("SELECT user, password, ip, firstlogin, lastlogin FROM " . $this->getDatabaseConfig()["table_prefix"] . "serverauthdata WHERE ip='" . $player->getAddress() . "'")) + 1 <= $cfg["register"]["max-ip"]) {
                             $query = "INSERT INTO " . $this->getDatabaseConfig()["table_prefix"] . "serverauthdata (user, password, ip, firstlogin, lastlogin) VALUES ('" . $player->getName() . "', '" . hash($this->getPasswordHash(), $password) . "', '" . $player->getAddress() . "', '" . $player->getFirstPlayed() . "', '" . $player->getLastPlayed() . "')";
                             if ($this->getDatabase()->query($query)) {
                                 return ServerAuth::SUCCESS;
                             } else {
                                 return ServerAuth::ERR_GENERIC;
                             }
                         } else {
                             return ServerAuth::ERR_MAX_IP_REACHED;
                         }
                     } else {
                         $query = "INSERT INTO " . $this->getDatabaseConfig()["table_prefix"] . "serverauthdata (user, password, ip, firstlogin, lastlogin) VALUES ('" . $player->getName() . "', '" . hash($this->getPasswordHash(), $password) . "', '" . $player->getAddress() . "', '" . $player->getFirstPlayed() . "', '" . $player->getLastPlayed() . "')";
                         if ($this->getDatabase()->query($query)) {
                             return ServerAuth::SUCCESS;
                         } else {
                             return ServerAuth::ERR_GENERIC;
                         }
                     }
                 } else {
                     return ServerAuth::ERR_GENERIC;
                 }
             } else {
                 if ($cfg["register"]["enable-max-ip"]) {
                     if ($this->grep($this->getDataFolder() . "users/", $player->getAddress()) + 1 <= $cfg["register"]["max-ip"]) {
                         $data = new Config($this->getDataFolder() . "users/" . strtolower($player->getName() . ".yml"), Config::YAML);
                         $data->set("password", hash($this->getPasswordHash(), $password));
                         $data->set("ip", $player->getAddress());
                         $data->set("firstlogin", $player->getFirstPlayed());
                         $data->set("lastlogin", $player->getLastPlayed());
                         $data->save();
                         return ServerAuth::SUCCESS;
                     } else {
                         return ServerAuth::ERR_MAX_IP_REACHED;
                     }
                 } else {
                     $data = new Config($this->getDataFolder() . "users/" . strtolower($player->getName() . ".yml"), Config::YAML);
                     $data->set("password", hash($this->getPasswordHash(), $password));
                     $data->set("ip", $player->getAddress());
                     $data->set("firstlogin", $player->getFirstPlayed());
                     $data->set("lastlogin", $player->getLastPlayed());
                     $data->save();
                     return ServerAuth::SUCCESS;
                 }
             }
         }
     }
 }
開發者ID:RedstoneAlmeida,項目名稱:SliceAuth,代碼行數:74,代碼來源:ServerAuth.php

示例7: getFixedMessage

 /**
  * @param Player $player
  * @param string $message
  * @return string
  */
 public function getFixedMessage(Player $player, $message = "")
 {
     return str_replace(["{PLAYER_ADDRESS}", "{PLAYER_DISPLAY_NAME}", "{PLAYER_NAME}", "{PLAYER_PORT}"], [$player->getAddress(), $player->getDisplayName(), $player->getName(), $player->getPort()], $message);
 }
開發者ID:pomee4,項目名稱:PocketMine-Plugins,代碼行數:9,代碼來源:PlanB.php

示例8: defaultLoginData

 protected static function defaultLoginData($uid, Player $player)
 {
     $name = $player->getName();
     $ip = $player->getAddress();
     return ["uid" => $uid, "name" => $name, "nicks" => "|{$name}|", "lastip" => "", "status" => Settings::STATUS_ONLINE, "lastses" => Settings::$LOCALIZE_CLASS, "authuuid" => $player->getUniqueId(), "coins" => 100.0, "hash" => str_repeat("0", 128), "pwprefix" => "", "pwlen" => 0, "registration" => time(), "laston" => time(), "ontime" => 0, "config" => Settings::CONFIG_DEFAULT_VALUE, "lastgrind" => 0, "rank" => 0, "warnpts" => 0, "lastwarn" => 0, "tid" => -1, "teamrank" => -1, "teamjoin" => 0, "ignorelist" => ",", "iphist" => ",{$ip},", "isnew" => true, "email" => self::EMAIL_UNVERIFIED, "friends" => [], "langs" => [], "purchases" => []];
 }
開發者ID:Addison118,項目名稱:LegionPE-Theta-Base-1,代碼行數:6,代碼來源:BasePlugin.php

示例9: forcePlayerDisconnect

 public function forcePlayerDisconnect(Player $player)
 {
     // https://forums.pocketmine.net/threads/temporary-solution-for-transferring-players-in-0-12-1.11759/
     // find out the RakLib interface, which is the network interface that MCPE players connect with
     foreach ($this->getServer()->getNetwork()->getInterfaces() as $interface) {
         if ($interface instanceof RakLibInterface) {
             $raklib = $interface;
             break;
         }
     }
     if (!isset($raklib)) {
         Server::getInstance()->getLogger()->critical(Main::PREFIX . "rakLib not found");
         return;
     }
     // calculate the identifier for the player used by RakLib
     $identifier = $player->getAddress() . ":" . $player->getPort();
     // this method call is the most important one - it sends some signal to RakLib that makes it think that the client has clicked the "Quit to Title" button (or timed out). Some RakLib internal stuff will then tell PocketMine that the player has quitted.
     $raklib->closeSession($identifier, "transfer");
 }
開發者ID:mwvent,項目名稱:WattzMCPE,代碼行數:19,代碼來源:Main.php

示例10: getEmail

 public function getEmail(Player $player)
 {
     if ($this->getEmailToIp($player->getAddress()) != false) {
         return $this->getEmailToIp($player->getAddress());
     } else {
         if ($this->getEmailToName($player->getName()) != false) {
             return $this->getEmailToName($player->getName());
         }
     }
     return false;
 }
開發者ID:JungHyun3459,項目名稱:EmailAuth,代碼行數:11,代碼來源:DataBase.php

示例11: registerPlayer

 /**
  * Register a player to ServerAuth
  * 
  * @param Player $player
  * @param string $password
  * 
  * @return int|boolean true on SUCCESS, otherwise the current error
  */
 public function registerPlayer(Player $player, $password)
 {
     $cfg = $this->getConfig()->getAll();
     if ($this->isPlayerRegistered($player->getName())) {
         return ServerAuth::ERR_USER_ALREADY_REGISTERED;
     } else {
         if (strlen($password) <= $cfg["minPasswordLength"]) {
             return ServerAuth::ERR_PASSWORD_TOO_SHORT;
         } elseif (strlen($password) >= $cfg["maxPasswordLength"]) {
             return ServerAuth::ERR_PASSWORD_TOO_LONG;
         } else {
             //Reset cancelled message
             $this->canc_message = $this->chlang["operation-cancelled"];
             $this->getServer()->getPluginManager()->callEvent($event = new Events\ServerAuthRegisterEvent($player, $password));
             if ($event->isCancelled()) {
                 return ServerAuth::CANCELLED;
             }
             if ($this->getDataProvider()) {
                 //Check MySQL connection
                 if ($this->getDatabase() && $this->getDatabase()->ping()) {
                     if ($cfg["register"]["enable-max-ip"]) {
                         $stmt = $this->getDatabase()->prepare("SELECT user, password, ip, firstlogin, lastlogin FROM " . $this->getDatabaseConfig()["table_prefix"] . "serverauthdata WHERE ip=?");
                         $stmt_address = $player->getAddress();
                         $stmt->bind_param("s", $stmt_address);
                         $stmt->execute();
                         $stmt->store_result();
                         if ($stmt->num_rows + 1 <= $cfg["register"]["max-ip"]) {
                             $stmt = $this->getDatabase()->prepare("INSERT INTO " . $this->getDatabaseConfig()["table_prefix"] . "serverauthdata (user, password, ip, firstlogin, lastlogin) VALUES (?, ?, ?, ?, ?)");
                             $stmt_player = $player->getName();
                             $stmt_password = hash($this->getPasswordHash(), $password);
                             $stmt_address = $player->getAddress();
                             $stmt_firstlogin = $player->getFirstPlayed();
                             $stmt_lastlogin = $player->getLastPlayed();
                             $stmt->bind_param("sssss", $stmt_player, $stmt_password, $stmt_address, $stmt_firstlogin, $stmt_lastlogin);
                             if ($stmt->execute()) {
                                 //Set User in cached array
                                 if (!isset($this->cached_registered_users[strtolower($player->getName())])) {
                                     $this->cached_registered_users[strtolower($player->getName())] = "";
                                 }
                                 $stmt->close();
                                 return ServerAuth::SUCCESS;
                             } else {
                                 $stmt->close();
                                 return ServerAuth::ERR_GENERIC;
                             }
                         } else {
                             return ServerAuth::ERR_MAX_IP_REACHED;
                         }
                     } else {
                         $stmt = $this->getDatabase()->prepare("INSERT INTO " . $this->getDatabaseConfig()["table_prefix"] . "serverauthdata (user, password, ip, firstlogin, lastlogin) VALUES (?, ?, ?, ?, ?)");
                         $stmt_player = $player->getName();
                         $stmt_password = hash($this->getPasswordHash(), $password);
                         $stmt_address = $player->getAddress();
                         $stmt_firstlogin = $player->getFirstPlayed();
                         $stmt_lastlogin = $player->getLastPlayed();
                         $stmt->bind_param("sssss", $stmt_player, $stmt_password, $stmt_address, $stmt_firstlogin, $stmt_lastlogin);
                         if ($stmt->execute()) {
                             //Set User in cached array
                             if (!isset($this->cached_registered_users[strtolower($player->getName())])) {
                                 $this->cached_registered_users[strtolower($player->getName())] = "";
                             }
                             $stmt->close();
                             return ServerAuth::SUCCESS;
                         } else {
                             $stmt->close();
                             return ServerAuth::ERR_GENERIC;
                         }
                     }
                 } else {
                     return ServerAuth::ERR_GENERIC;
                 }
             } else {
                 if ($cfg["register"]["enable-max-ip"]) {
                     if ($this->grep($this->getDataFolder() . "users/", $player->getAddress()) + 1 <= $cfg["register"]["max-ip"]) {
                         $data = new Config($this->getDataFolder() . "users/" . strtolower($player->getName() . ".yml"), Config::YAML);
                         $data->set("password", hash($this->getPasswordHash(), $password));
                         $data->set("ip", $player->getAddress());
                         $data->set("firstlogin", $player->getFirstPlayed());
                         $data->set("lastlogin", $player->getLastPlayed());
                         $data->save();
                         //Set User in cached array
                         if (!isset($this->cached_registered_users[strtolower($player->getName())])) {
                             $this->cached_registered_users[strtolower($player->getName())] = "";
                         }
                         return ServerAuth::SUCCESS;
                     } else {
                         return ServerAuth::ERR_MAX_IP_REACHED;
                     }
                 } else {
                     $data = new Config($this->getDataFolder() . "users/" . strtolower($player->getName() . ".yml"), Config::YAML);
                     $data->set("password", hash($this->getPasswordHash(), $password));
                     $data->set("ip", $player->getAddress());
//.........這裏部分代碼省略.........
開發者ID:majovec,項目名稱:ServerAuth,代碼行數:101,代碼來源:ServerAuth.php

示例12: transferPlayer0

 private function transferPlayer0(Player $player, $ip, $port)
 {
     $sp = new TransferPacket();
     $sp->address = $this->getHostByName($ip);
     $sp->port = $port;
     $player->dataPacket($sp);
     $interfaces = $this->getServer()->getNetwork()->getInterfaces();
     foreach ($interfaces as $interface) {
         if ($interface instanceof RakLibInterface) {
             //				$class = new \ReflectionClass(RakLibInterface::class);
             //				$prop = $class->getProperty("rakLib");
             //				$prop->setAccessible(true);
             //				/** @var RakLibServer $value */
             //				$value = $prop->getValue($interface);
             $identifier = $player->getAddress() . ":" . $player->getPort();
             //				$value->pushMainToThreadPacket(RakLib::PACKET_CLOSE_SESSION . chr(strlen($identifier)) . $identifier);
             $interface->closeSession($identifier, "transferring");
         }
     }
 }
開發者ID:legoboy0215,項目名稱:LegionPE-Theta-Base,代碼行數:20,代碼來源:BasePlugin.php

示例13: processLogin

 public function processLogin(Player $player, CompoundTag $nbt)
 {
     if (!$this->server->isWhitelisted(strtolower($player->getName()))) {
         $player->close($player->getLeaveMessage(), "Server is white-listed");
         return;
     } elseif ($this->server->getNameBans()->isBanned(strtolower($player->getName())) or $this->server->getIPBans()->isBanned($player->getAddress())) {
         $player->close($player->getLeaveMessage(), "You are banned");
         return;
     }
     if ($player->hasPermission(Server::BROADCAST_CHANNEL_USERS)) {
         $this->server->getPluginManager()->subscribeToPermission(Server::BROADCAST_CHANNEL_USERS, $player);
     }
     if ($player->hasPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE)) {
         $this->server->getPluginManager()->subscribeToPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE, $player);
     }
     foreach ($this->server->getOnlinePlayers() as $p) {
         if ($p !== $player and strtolower($p->getName()) === strtolower($player->getName())) {
             if ($p->kick("logged in from another location") === false) {
                 $player->close($player->getLeaveMessage(), "Logged in from another location");
                 return;
             }
         } elseif ($p->loggedIn and $player->getUniqueId()->equals($p->getUniqueId())) {
             if ($p->kick("logged in from another location") === false) {
                 $player->close($player->getLeaveMessage(), "Logged in from another location");
                 return;
             }
         }
     }
     // $nbt = $player->server->getOfflinePlayerData ( $this->username );
     if (!isset($nbt->NameTag)) {
         $nbt->NameTag = new StringTag("NameTag", $this->getPrivateVariableData($player, 'username'));
     } else {
         $nbt["NameTag"] = $this->getPrivateVariableData($player, 'username');
     }
     $player->gamemode = $nbt["playerGameType"] & 0x3;
     if ($this->server->getForceGamemode()) {
         $player->gamemode = $this->server->getGamemode();
         $nbt->playerGameType = new IntTag("playerGameType", $player->gamemode);
     }
     // $player->allowFlight = $player->isCreative ();
     $this->setPrivateVariableData($player, 'allowFlight', $player->isCreative());
     if (($level = $this->server->getLevelByName($nbt["Level"])) === null) {
         $player->setLevel($this->server->getDefaultLevel());
         $nbt["Level"] = $this->level->getName();
         $nbt["Pos"][0] = $player->level->getSpawnLocation()->x;
         $nbt["Pos"][1] = $player->level->getSpawnLocation()->y;
         $nbt["Pos"][2] = $player->level->getSpawnLocation()->z;
     } else {
         $player->setLevel($level);
     }
     if (!$nbt instanceof CompoundTag) {
         $player->close($player->getLeaveMessage(), "Invalid data");
         return;
     }
     $player->achievements = [];
     /** @var Byte $achievement */
     foreach ($nbt->Achievements as $achievement) {
         $player->achievements[$achievement->getName()] = $achievement->getValue() > 0 ? true : false;
     }
     $nbt->lastPlayed = new LongTag("lastPlayed", floor(microtime(true) * 1000));
     if ($this->server->getAutoSave()) {
         $this->server->saveOfflinePlayerData($player->getName(), $nbt, true);
     }
     // parent::__construct ( $this->level->getChunk ( $nbt ["Pos"] [0] >> 4, $nbt ["Pos"] [2] >> 4, true ), $nbt );
     $this->entityConstruct($player, $player->getLevel()->getChunk($nbt["Pos"][0] >> 4, $nbt["Pos"][2] >> 4, true), $nbt);
     $player->loggedIn = true;
     $this->server->addOnlinePlayer($player);
     $this->server->getPluginManager()->callEvent($ev = new PlayerLoginEvent($player, "Plugin reason"));
     if ($ev->isCancelled()) {
         $player->close($player->getLeaveMessage(), $ev->getKickMessage());
         return;
     }
     if ($player->isCreative()) {
         $player->getInventory()->setHeldItemSlot(0);
     } else {
         $player->getInventory()->setHeldItemSlot($player->getInventory()->getHotbarSlotIndex(0));
     }
     $pk = new PlayStatusPacket();
     $pk->status = PlayStatusPacket::LOGIN_SUCCESS;
     $player->dataPacket($pk);
     if ($this->getPrivateVariableData($player, 'spawnPosition') === null and isset($player->namedtag->SpawnLevel) and ($level = $this->server->getLevelByName($player->namedtag["SpawnLevel"])) instanceof Level) {
         $this->setPrivateVariableData($player, 'spawnPosition', new Position($player->namedtag["SpawnX"], $player->namedtag["SpawnY"], $player->namedtag["SpawnZ"], $level));
     }
     $spawnPosition = $player->getSpawn();
     $pk = new StartGamePacket();
     $pk->seed = -1;
     $pk->dimension = 0;
     $pk->x = $player->x;
     $pk->y = $player->y;
     $pk->z = $player->z;
     $pk->spawnX = (int) $spawnPosition->x;
     $pk->spawnY = (int) $spawnPosition->y;
     $pk->spawnZ = (int) $spawnPosition->z;
     $pk->generator = 1;
     // 0 old, 1 infinite, 2 flat
     $pk->gamemode = $player->gamemode & 0x1;
     $pk->eid = 0;
     // Always use EntityID as zero for the actual player
     $player->dataPacket($pk);
     $pk = new SetTimePacket();
//.........這裏部分代碼省略.........
開發者ID:organization,項目名稱:SpawningPool,代碼行數:101,代碼來源:AuthenticateCallback.php


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