本文整理汇总了PHP中pocketmine\utils\Utils::getRandomBytes方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils::getRandomBytes方法的具体用法?PHP Utils::getRandomBytes怎么用?PHP Utils::getRandomBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\utils\Utils
的用法示例。
在下文中一共展示了Utils::getRandomBytes方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: networkFunctions
private function networkFunctions()
{
$config = new Config(\pocketmine\DATA . "server.properties", Config::PROPERTIES);
echo "[!] " . $this->lang->query_warning1 . "\n";
echo "[!] " . $this->lang->query_warning2 . "\n";
echo "[?] " . $this->lang->query_disable . " (y/N): ";
if (strtolower($this->getInput("n")) === "y") {
$config->set("enable-query", false);
} else {
$config->set("enable-query", true);
}
echo "[*] " . $this->lang->rcon_info . "\n";
echo "[?] " . $this->lang->rcon_enable . " (y/N): ";
if (strtolower($this->getInput("n")) === "y") {
$config->set("enable-rcon", true);
$password = substr(base64_encode(@Utils::getRandomBytes(20, false)), 3, 10);
$config->set("rcon.password", $password);
echo "[*] " . $this->lang->rcon_password . ": " . $password . "\n";
} else {
$config->set("enable-rcon", false);
}
/*echo "[*] " . $this->lang->usage_info . "\n";
echo "[?] " . $this->lang->usage_disable . " (y/N): ";
if(strtolower($this->getInput("n")) === "y"){
$config->set("send-usage", false);
}else{
$config->set("send-usage", true);
}*/
$config->save();
echo "[*] " . $this->lang->ip_get . "\n";
$externalIP = Utils::getIP();
$internalIP = gethostbyname(trim(`hostname`));
echo "[!] " . $this->lang->get("ip_warning", ["{{EXTERNAL_IP}}", "{{INTERNAL_IP}}"], [$externalIP, $internalIP]) . "\n";
echo "[!] " . $this->lang->ip_confirm;
$this->getInput();
}
示例2: exit
$logger->critical("Please use the installer provided on the homepage, or recompile PHP again.");
$logger->shutdown();
$logger->join();
exit(1);
//Exit with error
}
if (\file_exists(\pocketmine\PATH . ".git/refs/heads/master")) {
//Found Git information!
\define("pocketmine\\GIT_COMMIT", \strtolower(\trim(\file_get_contents(\pocketmine\PATH . ".git/refs/heads/master"))));
} else {
//Unknown :(
\define("pocketmine\\GIT_COMMIT", \str_repeat("00", 20));
}
@\define("ENDIANNESS", \pack("d", 1) === "?ð" ? Binary::BIG_ENDIAN : Binary::LITTLE_ENDIAN);
@\define("INT32_MASK", \is_int(4294967295.0) ? 4294967295.0 : -1);
@\ini_set("opcache.mmap_base", \bin2hex(Utils::getRandomBytes(8, \false)));
//Fix OPCache address errors
if (!\file_exists(\pocketmine\DATA . "server.properties") and !isset($opts["no-wizard"])) {
new Installer();
}
if (\Phar::running(\true) === "") {
$logger->warning("Non-packaged PocketMine-MP installation detected, do not use on production.");
}
ThreadManager::init();
$server = new Server($autoloader, $logger, \pocketmine\PATH, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
$logger->info("Stopping other threads");
foreach (ThreadManager::getInstance()->getAll() as $id => $thread) {
$logger->debug("Stopping " . (new \ReflectionClass($thread))->getShortName() . " thread");
$thread->quit();
}
$killer = new ServerKiller(8);
示例3: __construct
/**
* @param \ClassLoader $autoloader
* @param \ThreadedLogger $logger
* @param string $filePath
* @param string $dataPath
* @param string $pluginPath
*/
public function __construct(\ClassLoader $autoloader, \ThreadedLogger $logger, $filePath, $dataPath, $pluginPath)
{
self::$instance = $this;
$this->autoloader = $autoloader;
$this->logger = $logger;
$this->filePath = $filePath;
if (!file_exists($dataPath . "worlds/")) {
mkdir($dataPath . "worlds/", 0777);
}
if (!file_exists($dataPath . "players/")) {
mkdir($dataPath . "players/", 0777);
}
if (!file_exists($dataPath . "CrashDump/")) {
mkdir($dataPath . "CrashDump/", 0777);
}
if (!file_exists($pluginPath)) {
mkdir($pluginPath, 0777);
}
$this->dataPath = realpath($dataPath) . DIRECTORY_SEPARATOR;
$this->pluginPath = realpath($pluginPath) . DIRECTORY_SEPARATOR;
$this->console = new CommandReader();
$version = new VersionString($this->getPocketMineVersion());
$this->logger->info(TextFormat::GREEN . " ____ _ _ __ __ _ " . TextFormat::AQUA . " _____ _ _ _ ");
$this->logger->info(TextFormat::GREEN . " | _ \\ ___ ___| | _____| |_| \\/ (_)_ __ ___ " . TextFormat::AQUA . "| ____| (_) |_ ___ ");
$this->logger->info(TextFormat::GREEN . " | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\ _____ " . TextFormat::AQUA . "| _| | | | __/ _ \\ ");
$this->logger->info(TextFormat::GREEN . " | __/ (_) | (__| < __/ |_| | | | | | | | __/ |_____| " . TextFormat::AQUA . "| |___| | | || __/");
$this->logger->info(TextFormat::GREEN . " |_| \\___/ \\___|_|\\_\\___|\\__|_| |_|_|_| |_|\\___| " . TextFormat::AQUA . "|_____|_|_|\\__\\___|");
$this->logger->info(TextFormat::GREEN . " Version: " . TextFormat::AQUA . $version);
$this->logger->info("Loading pocketmine.yml...");
if (!file_exists($this->dataPath . "pocketmine.yml")) {
$content = file_get_contents($this->filePath . "src/pocketmine/resources/pocketmine.yml");
if ($version->isDev()) {
$content = str_replace("preferred-channel: stable", "preferred-channel: beta", $content);
}
@file_put_contents($this->dataPath . "pocketmine.yml", $content);
}
$this->config = new Config($this->dataPath . "pocketmine.yml", Config::YAML, []);
$this->logger->info("Loading server properties...");
$this->properties = new Config($this->dataPath . "server.properties", Config::PROPERTIES, ["motd" => "Minecraft: PE Server", "server-port" => 19132, "white-list" => false, "announce-player-achievements" => true, "spawn-protection" => 16, "max-players" => 20, "allow-flight" => false, "spawn-animals" => true, "spawn-mobs" => true, "gamemode" => 0, "force-gamemode" => false, "hardcore" => false, "pvp" => true, "difficulty" => 1, "generator-settings" => "", "level-name" => "world", "level-seed" => "", "level-type" => "DEFAULT", "enable-query" => true, "enable-rcon" => false, "rcon.password" => substr(base64_encode(@Utils::getRandomBytes(20, false)), 3, 10), "auto-save" => true]);
$this->forceLanguage = $this->getProperty("settings.force-language", false);
$this->baseLang = new BaseLang($this->getProperty("settings.language", BaseLang::FALLBACK_LANGUAGE));
$this->logger->info($this->getLanguage()->translateString("language.selected", [$this->getLanguage()->getName(), $this->getLanguage()->getLang()]));
$this->memoryManager = new MemoryManager($this);
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.start", [TextFormat::AQUA . $this->getVersion()]));
if (($poolSize = $this->getProperty("settings.async-workers", "auto")) === "auto") {
$poolSize = ServerScheduler::$WORKERS;
$processors = Utils::getCoreCount() - 2;
if ($processors > 0) {
$poolSize = max(1, $processors);
}
}
ServerScheduler::$WORKERS = $poolSize;
if ($this->getProperty("network.batch-threshold", 256) >= 0) {
Network::$BATCH_THRESHOLD = (int) $this->getProperty("network.batch-threshold", 256);
} else {
Network::$BATCH_THRESHOLD = -1;
}
$this->networkCompressionLevel = $this->getProperty("network.compression-level", 7);
$this->networkCompressionAsync = $this->getProperty("network.async-compression", true);
$this->autoTickRate = (bool) $this->getProperty("level-settings.auto-tick-rate", true);
$this->autoTickRateLimit = (int) $this->getProperty("level-settings.auto-tick-rate-limit", 20);
$this->alwaysTickPlayers = (int) $this->getProperty("level-settings.always-tick-players", false);
$this->baseTickRate = (int) $this->getProperty("level-settings.base-tick-rate", 1);
$this->scheduler = new ServerScheduler();
if ($this->getConfigBoolean("enable-rcon", false) === true) {
$this->rcon = new RCON($this, $this->getConfigString("rcon.password", ""), $this->getConfigInt("rcon.port", $this->getPort()), ($ip = $this->getIp()) != "" ? $ip : "0.0.0.0", $this->getConfigInt("rcon.threads", 1), $this->getConfigInt("rcon.clients-per-thread", 50));
}
$this->entityMetadata = new EntityMetadataStore();
$this->playerMetadata = new PlayerMetadataStore();
$this->levelMetadata = new LevelMetadataStore();
$this->operators = new Config($this->dataPath . "ops.txt", Config::ENUM);
$this->whitelist = new Config($this->dataPath . "white-list.txt", Config::ENUM);
if (file_exists($this->dataPath . "banned.txt") and !file_exists($this->dataPath . "banned-players.txt")) {
@rename($this->dataPath . "banned.txt", $this->dataPath . "banned-players.txt");
}
@touch($this->dataPath . "banned-players.txt");
$this->banByName = new BanList($this->dataPath . "banned-players.txt");
$this->banByName->load();
@touch($this->dataPath . "banned-ips.txt");
$this->banByIP = new BanList($this->dataPath . "banned-ips.txt");
$this->banByIP->load();
$this->maxPlayers = $this->getConfigInt("max-players", 20);
$this->setAutoSave($this->getConfigBoolean("auto-save", true));
if ($this->getConfigBoolean("hardcore", false) === true and $this->getDifficulty() < 3) {
$this->setConfigInt("difficulty", 3);
}
define("pocketmine\\DEBUG", (int) $this->getProperty("debug.level", 1));
if ($this->logger instanceof MainLogger) {
$this->logger->setLogDebug(\pocketmine\DEBUG > 1);
}
if (\pocketmine\DEBUG >= 0) {
@cli_set_process_title($this->getName() . " " . $this->getPocketMineVersion());
}
//.........这里部分代码省略.........
示例4: __construct
/**
* @param \ClassLoader $autoloader
* @param \ThreadedLogger $logger
* @param string $filePath
* @param string $dataPath
* @param string $pluginPath
*/
public function __construct(\ClassLoader $autoloader, \ThreadedLogger $logger, $filePath, $dataPath, $pluginPath)
{
self::$instance = $this;
$this->autoloader = $autoloader;
$this->logger = $logger;
$this->filePath = $filePath;
if (!file_exists($dataPath . "worlds/")) {
mkdir($dataPath . "worlds/", 0777);
}
if (!file_exists($dataPath . "players/")) {
mkdir($dataPath . "players/", 0777);
}
if (!file_exists($pluginPath)) {
mkdir($pluginPath, 0777);
}
$this->dataPath = realpath($dataPath) . DIRECTORY_SEPARATOR;
$this->pluginPath = realpath($pluginPath) . DIRECTORY_SEPARATOR;
$this->console = new CommandReader();
$version = new VersionString($this->getPocketMineVersion());
$this->logger->info("Starting Minecraft: PE server version " . TextFormat::AQUA . $this->getVersion());
$this->logger->info("Loading pocketmine-soft.yml...");
if (!file_exists($this->dataPath . "pocketmine-soft.yml")) {
$content = file_get_contents($this->filePath . "src/pocketmine/resources/pocketmine-soft.yml");
@file_put_contents($this->dataPath . "pocketmine-soft.yml", $content);
}
$this->softConfig = new Config($this->dataPath . "pocketmine-soft.yml", Config::YAML, []);
$this->logger->info("Loading pocketmine.yml...");
if (!file_exists($this->dataPath . "pocketmine.yml")) {
$content = file_get_contents($this->filePath . "src/pocketmine/resources/pocketmine.yml");
@file_put_contents($this->dataPath . "pocketmine.yml", $content);
}
$this->config = new Config($this->dataPath . "pocketmine.yml", Config::YAML, []);
$this->logger->info("Loading server properties...");
$this->properties = new Config($this->dataPath . "server.properties", Config::PROPERTIES, ["motd" => "Minecraft: PE Server", "server-port" => 19132, "memory-limit" => "256M", "white-list" => false, "announce-player-achievements" => true, "spawn-protection" => 16, "max-players" => 20, "allow-flight" => false, "spawn-animals" => true, "spawn-mobs" => true, "gamemode" => 0, "force-gamemode" => false, "hardcore" => false, "pvp" => true, "difficulty" => 1, "generator-settings" => "", "level-name" => "world", "level-seed" => "", "level-type" => "DEFAULT", "enable-query" => true, "enable-rcon" => false, "rcon.password" => substr(base64_encode(@Utils::getRandomBytes(20, false)), 3, 10), "auto-save" => true]);
ServerScheduler::$WORKERS = 4;
if ($this->getProperty("network.batch-threshold", 256) >= 0) {
Network::$BATCH_THRESHOLD = (int) $this->getProperty("network.batch-threshold", 256);
} else {
Network::$BATCH_THRESHOLD = -1;
}
$this->networkCompressionLevel = $this->getProperty("network.compression-level", 7);
$this->networkCompressionAsync = $this->getProperty("network.async-compression", true);
$this->scheduler = new ServerScheduler();
if ($this->getConfigBoolean("enable-rcon", false) === true) {
$this->rcon = new RCON($this, $this->getConfigString("rcon.password", ""), $this->getConfigInt("rcon.port", $this->getPort()), ($ip = $this->getIp()) != "" ? $ip : "0.0.0.0", $this->getConfigInt("rcon.threads", 1), $this->getConfigInt("rcon.clients-per-thread", 50));
}
$this->entityMetadata = new EntityMetadataStore();
$this->playerMetadata = new PlayerMetadataStore();
$this->levelMetadata = new LevelMetadataStore();
$this->operators = new Config($this->dataPath . "ops.txt", Config::ENUM);
$this->whitelist = new Config($this->dataPath . "white-list.txt", Config::ENUM);
if (file_exists($this->dataPath . "banned.txt") and !file_exists($this->dataPath . "banned-players.txt")) {
@rename($this->dataPath . "banned.txt", $this->dataPath . "banned-players.txt");
}
@touch($this->dataPath . "banned-players.txt");
$this->banByName = new BanList($this->dataPath . "banned-players.txt");
$this->banByName->load();
@touch($this->dataPath . "banned-ips.txt");
$this->banByIP = new BanList($this->dataPath . "banned-ips.txt");
$this->banByIP->load();
$this->maxPlayers = $this->getConfigInt("max-players", 20);
$this->setAutoSave($this->getConfigBoolean("auto-save", true));
if (($memory = str_replace("B", "", strtoupper($this->getConfigString("memory-limit", "256M")))) !== false) {
$value = ["M" => 1, "G" => 1024];
$real = (int) substr($memory, 0, -1) * $value[substr($memory, -1)];
if ($real < 128) {
$this->logger->warning($this->getName() . " may not work right with less than 128MB of RAM", true, true, 0);
}
@ini_set("memory_limit", $memory);
} else {
$this->setConfigString("memory-limit", "256M");
}
$this->network = new Network($this);
if ($this->getConfigBoolean("hardcore", false) === true and $this->getDifficulty() < 3) {
$this->setConfigInt("difficulty", 3);
}
define("pocketmine\\DEBUG", (int) $this->getProperty("debug.level", 1));
if ($this->logger instanceof MainLogger) {
$this->logger->setLogDebug(\pocketmine\DEBUG > 1);
}
define("ADVANCED_CACHE", $this->getProperty("settings.advanced-cache", false));
if (ADVANCED_CACHE == true) {
$this->logger->info("Advanced cache enabled");
}
Level::$COMPRESSION_LEVEL = $this->getProperty("chunk-sending.compression-level", 8);
if (defined("pocketmine\\DEBUG") and \pocketmine\DEBUG >= 0) {
@\cli_set_process_title($this->getName() . " " . $this->getPocketMineVersion());
}
$this->logger->info("Starting Minecraft PE server on " . ($this->getIp() === "" ? "*" : $this->getIp()) . ":" . $this->getPort());
define("BOOTUP_RANDOM", @Utils::getRandomBytes(16));
$this->serverID = Utils::getMachineUniqueId($this->getIp() . $this->getPort());
$this->addInterface($this->mainInterface = new RakLibInterface($this));
$this->logger->info("This server is running " . $this->getName() . " version " . ($version->isDev() ? TextFormat::YELLOW : "") . $version->get(true) . TextFormat::WHITE . " \"" . $this->getCodename() . "\" (API " . $this->getApiVersion() . ")");
//.........这里部分代码省略.........
示例5: regenerateToken
public function regenerateToken()
{
$this->lastToken = $this->token;
$this->token = @Utils::getRandomBytes(16, \false);
}
示例6: bigBrother_handleAuthentication
public function bigBrother_handleAuthentication(BigBrother $plugin, $username, $onlineMode)
{
if ($this->bigBrother_status === 0) {
$this->bigBrother_username = $username;
if ($onlineMode === true) {
$pk = new EncryptionRequestPacket();
$pk->serverID = "";
$pk->publicKey = $plugin->getASN1PublicKey();
$pk->verifyToken = $this->bigBrother_checkToken = Utils::getRandomBytes(4, false, true, $pk->publicKey);
$this->putRawPacket($pk);
} else {
$task = new OnlineProfile($this->clientID, $this->bigBrother_username);
$this->server->getScheduler()->scheduleAsyncTask($task);
}
}
}
示例7: __construct
/**
* @param \ClassLoader $autoloader
* @param \ThreadedLogger $logger
* @param string $filePath
* @param string $dataPath
* @param string $pluginPath
*/
public function __construct(\ClassLoader $autoloader, \ThreadedLogger $logger, $filePath, $dataPath, $pluginPath)
{
self::$instance = $this;
self::$sleeper = new \Threaded();
$this->autoloader = $autoloader;
$this->logger = $logger;
$this->filePath = $filePath;
try {
if (!file_exists($dataPath . "worlds/")) {
mkdir($dataPath . "worlds/", 0777);
}
if (!file_exists($dataPath . "players/")) {
mkdir($dataPath . "players/", 0777);
}
if (!file_exists($pluginPath)) {
mkdir($pluginPath, 0777);
}
if (!file_exists($dataPath . "crashdumps/")) {
mkdir($dataPath . "crashdumps/", 0777);
}
$this->dataPath = realpath($dataPath) . DIRECTORY_SEPARATOR;
$this->pluginPath = realpath($pluginPath) . DIRECTORY_SEPARATOR;
$this->console = new CommandReader();
$version = new VersionString($this->getPocketMineVersion());
$this->version = $version;
$this->aboutstring = "\n\n\t\t §5PocketMine-iTX §3Genisys §fis a fork of PocketMine-MP.\n\t\t Powered by §5iTX Technologies LLC.\n\t\t §fVersion: §6" . $this->getPocketMineVersion() . "\n\t\t §fClient Version: §d0.13.1 alpha\n\t\t §fYou could get the lastest code on https://github.com/iTXTech/Genisys\n\t\t §fDonate link: http://pl.zxda.net/plugins/203.html\n\t\t §f如果你在免费使用本核心,希望你可以进入上面的链接捐赠给我们,这会成为我们前进的动力。\n\t\t\n";
$this->about();
$this->logger->info("Loading pocketmine.yml...");
if (!file_exists($this->dataPath . "pocketmine.yml")) {
$content = file_get_contents($this->filePath . "src/pocketmine/resources/pocketmine.yml");
if ($version->isDev()) {
$content = str_replace("preferred-channel: stable", "preferred-channel: beta", $content);
}
@file_put_contents($this->dataPath . "pocketmine.yml", $content);
}
$this->config = new Config($this->dataPath . "pocketmine.yml", Config::YAML, []);
$this->logger->info("Loading genisys.yml...");
$lang = $this->getProperty("settings.language", BaseLang::FALLBACK_LANGUAGE);
if (file_exists($this->filePath . "src/pocketmine/resources/genisys_{$lang}.yml")) {
$content = file_get_contents($file = $this->filePath . "src/pocketmine/resources/genisys_{$lang}.yml");
} else {
$content = file_get_contents($file = $this->filePath . "src/pocketmine/resources/genisys_eng.yml");
}
if (!file_exists($this->dataPath . "genisys.yml")) {
@file_put_contents($this->dataPath . "genisys.yml", $content);
}
$internelConfig = new Config($file, Config::YAML, []);
$this->advancedConfig = new Config($this->dataPath . "genisys.yml", Config::YAML, []);
$cfgVer = $this->getAdvancedProperty("config.version", 0, $internelConfig);
$advVer = $this->getAdvancedProperty("config.version", 0);
$this->loadAdvancedConfig();
if ($this->expWriteAhead > 0) {
$this->generateExpCache($this->expWriteAhead);
}
$this->logger->info("Loading server properties...");
$this->properties = new Config($this->dataPath . "server.properties", Config::PROPERTIES, ["motd" => "Minecraft: PE Server", "server-port" => 19132, "white-list" => false, "announce-player-achievements" => true, "spawn-protection" => 16, "max-players" => 20, "allow-flight" => false, "spawn-animals" => true, "spawn-mobs" => true, "gamemode" => 0, "force-gamemode" => false, "hardcore" => false, "pvp" => true, "difficulty" => 1, "generator-settings" => "", "level-name" => "world", "level-seed" => "", "level-type" => "DEFAULT", "enable-query" => true, "enable-rcon" => false, "rcon.password" => substr(base64_encode(@Utils::getRandomBytes(20, false)), 3, 10), "auto-save" => true]);
$this->forceLanguage = $this->getProperty("settings.force-language", false);
$this->baseLang = new BaseLang($this->getProperty("settings.language", BaseLang::FALLBACK_LANGUAGE));
$this->logger->info($this->getLanguage()->translateString("language.selected", [$this->getLanguage()->getName(), $this->getLanguage()->getLang()]));
$this->memoryManager = new MemoryManager($this);
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.start", [TextFormat::AQUA . $this->getVersion()]));
if (($poolSize = $this->getProperty("settings.async-workers", "auto")) === "auto") {
$poolSize = ServerScheduler::$WORKERS;
$processors = Utils::getCoreCount() - 2;
if ($processors > 0) {
$poolSize = max(1, $processors);
}
}
ServerScheduler::$WORKERS = $poolSize;
if ($this->getProperty("network.batch-threshold", 256) >= 0) {
Network::$BATCH_THRESHOLD = (int) $this->getProperty("network.batch-threshold", 256);
} else {
Network::$BATCH_THRESHOLD = -1;
}
$this->networkCompressionLevel = $this->getProperty("network.compression-level", 7);
$this->networkCompressionAsync = $this->getProperty("network.async-compression", true);
$this->autoTickRate = (bool) $this->getProperty("level-settings.auto-tick-rate", true);
$this->autoTickRateLimit = (int) $this->getProperty("level-settings.auto-tick-rate-limit", 20);
$this->alwaysTickPlayers = (int) $this->getProperty("level-settings.always-tick-players", false);
$this->baseTickRate = (int) $this->getProperty("level-settings.base-tick-rate", 1);
$this->scheduler = new ServerScheduler();
if ($this->getConfigBoolean("enable-rcon", false) === true) {
$this->rcon = new RCON($this, $this->getConfigString("rcon.password", ""), $this->getConfigInt("rcon.port", $this->getPort()), ($ip = $this->getIp()) != "" ? $ip : "0.0.0.0", $this->getConfigInt("rcon.threads", 1), $this->getConfigInt("rcon.clients-per-thread", 50));
}
$this->entityMetadata = new EntityMetadataStore();
$this->playerMetadata = new PlayerMetadataStore();
$this->levelMetadata = new LevelMetadataStore();
$this->operators = new Config($this->dataPath . "ops.txt", Config::ENUM);
$this->whitelist = new Config($this->dataPath . "white-list.txt", Config::ENUM);
if (file_exists($this->dataPath . "banned.txt") and !file_exists($this->dataPath . "banned-players.txt")) {
@rename($this->dataPath . "banned.txt", $this->dataPath . "banned-players.txt");
}
@touch($this->dataPath . "banned-players.txt");
//.........这里部分代码省略.........
示例8: bigBrother_handleAuthentication
public function bigBrother_handleAuthentication($plugin, $username, $onlineMode = false)
{
if ($this->bigBrother_status === 0) {
$this->bigBrother_username = $username;
if ($onlineMode === true) {
$pk = new EncryptionRequestPacket();
$pk->serverID = "";
$pk->publicKey = $plugin->getASN1PublicKey();
$pk->verifyToken = $this->bigBrother_checkToken = Utils::getRandomBytes(4, false, true, $pk->publicKey);
$this->putRawPacket($pk);
} else {
$info = $this->getProfile($username);
if (is_array($info)) {
$this->bigBrother_authenticate($info["id"], $info["properties"]);
}
}
}
}