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")); }
public function putPacket(Player $player, DataPacket $packet, $needACK = false, $immediate = true) { $packet->encode(); $pk = new RedirectPacket(); $pk->uuid = $player->getUniqueId(); $pk->direct = $immediate; $pk->mcpeBuffer = $packet->buffer; $this->synapseInterface->putPacket($pk); }
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 ($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->getConfig()->getNested("Messages.Login.Query", "Please login")); $this->initAppearance(); }
public function removeOnlinePlayer(Player $player) { if (isset($this->playerList[$player->getRawUniqueId()])) { unset($this->playerList[$player->getRawUniqueId()]); $pk = new PlayerListPacket(); $pk->type = PlayerListPacket::TYPE_REMOVE; $pk->entries[] = [$player->getUniqueId()]; Server::broadcastPacket($this->playerList, $pk); } }
/** * @param Player $player * @return null|string */ public function getValidUUID(Player $player) { $uniqueId = $player->getUniqueId()->toString(); return $uniqueId; }
/** * @param Player $player */ public function showPlayer(Player $player) { if ($player === $this) { return; } unset($this->hiddenPlayers[$player->getUniqueId()]); if ($player->isOnline()) { $player->spawnTo($this); } }
/** * @param Player $player * @return null|string */ public function getValidUUID(Player $player) { if ($this->isUUIDSupported) { if ($player->getUniqueId() === null) { return null; } $uniqueId = $player->getUniqueId()->toString(); } else { $uniqueId = $player->getUniqueId(); } return $uniqueId; }
public function onPlayerLogin(Player $player) { if ($this->sendUsageTicker > 0) { $this->uniquePlayers[$player->getUniqueId()] = $player->getUniqueId(); } }
public function addPlayer(Player $player) { $uuid = $player->getUniqueId()->toString(); $this->playerList[$uuid] = $player; }
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" => []]; }
/** * @param Player $player */ public function removeAttachment(Player $player) { if (isset($this->attachments[$player->getUniqueId()])) { $player->removeAttachment($this->attachments[$player->getUniqueId()]); unset($this->attachments[$player->getUniqueId()]); } }
public function removePlayer(Player $player) { unset($this->playerList[$player->getUniqueId()->toString()]); }
public function removePlayer(Player $player) { $this->playerList[spl_object_hash($player->getUniqueId())] = null; }
/** * @param Player $player * @return null|string */ public function getValidUUID(Player $player) { $uuid = $player->getUniqueId(); if ($uuid instanceof UUID) { return $uuid->toString(); } // Heheheh... $this->getLogger()->warning("Why did you give me an invalid unique id? *cries* (userName: "******", isConnected: " . $player->isConnected() . ", isOnline: " . $player->isOnline() . ", isValid: " . $player->isValid() . ")"); return null; }
/** * @param Player $player */ public function unregisterPlayer(Player $player) { $this->getLogger()->debug($this->getMessage("logger_messages.unregisterPlayer", $player->getName())); $uniqueId = $player->getUniqueId()->toString(); if (isset($this->attachments[$uniqueId])) { $player->removeAttachment($this->attachments[$uniqueId]); } unset($this->attachments[$uniqueId]); }
/** * @param Player $player */ public function removeAttachment(Player $player) { $uuid = $player->getUniqueId(); if (isset($this->attachments[$uuid]) and $this->attachments[$uuid] instanceof PermissionAttachment) { $player->removeAttachment($this->attachments[$uuid]); unset($this->attachments[$uuid]); } }
/** * @param Player $player */ public function removeCheatPlayer(Player $player) { unset($this->players[$player->getUniqueId()]); }