public function __construct(Session $session) { $this->session = $session; $this->main = $session->getMain(); $result = $this->main->getMySQLi()->query("SELECT progress,completions,falls,tmpfalls FROM parkour WHERE uid=%d;", MysqlConnection::ASSOC, $session->getUID()); if (is_array($result)) { $this->progress = (int) $result["progress"]; $this->completions = (int) $result["completions"]; $this->falls = (int) $result["falls"]; $this->tmpFalls = (int) $result["tmpfalls"]; } }
public function __construct(Session $session) { $this->session = $session; $this->onSince = time(); // $this->data = $this->session->getMain()->getMySQLi()->query( // "SELECT * FROM players WHERE INSTR(names, %s);", // MysqlConnection::ASSOC, $session->getPlayer()->getName() . "|"); $isOld = is_array($this->data = $this->session->getMain()->getMySQLi()->query("SELECT * FROM players WHERE primaryname=%s;", MysqlConnection::ASSOC, strtolower($session->getPlayer()->getName()))); if (!$isOld) { $session->getMain()->getStats()->increment(LegionPE::TITLE_LEGIONPE_NEW_JOINS); } else { foreach (["uid", "lastonline", "registry", "ipconfig", "notag", "lastgrind", "rank", "tid", "teamrank", "teamjointime", "warnpts"] as $key) { if (!isset($this->data[$key])) { $this->data[$key] = 0; } else { $this->data[$key] = (int) $this->data[$key]; } } $this->data["coins"] = $this->lastCoins = (double) $this->data["coins"]; } }
public function onRespawn(PlayerRespawnEvent $event, Session $session) { $event->setRespawnPosition(Settings::parkour_checkpoint_startPos($this->data[$session->getUID()]->getProgress(), $session->getMain()->getServer())); }