mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-18 01:14:10 +00:00
Removed clientID from checks
This commit is contained in:
parent
8bef816061
commit
883b18078f
@ -319,7 +319,7 @@ class PlayerAPI{
|
||||
while(($e = $l->fetchArray(SQLITE3_ASSOC)) !== false){
|
||||
$e = $this->getByEID($e["EID"]);
|
||||
if($e instanceof Player){
|
||||
$clients[$e->clientID] = $e;
|
||||
$clients[$e->CID] = $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -346,16 +346,6 @@ class PlayerAPI{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getByClientID($clientID){
|
||||
$clientID = (int) $clientID;
|
||||
$CID = $this->server->query("SELECT ip,port FROM players WHERE clientID = '".$clientID."';", true);
|
||||
$CID = PocketMinecraftServer::clientID($CID["ip"], $CID["port"]);
|
||||
if(isset($this->server->clients[$CID])){
|
||||
return $this->server->clients[$CID];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function online(){
|
||||
$o = array();
|
||||
foreach($this->server->clients as $p){
|
||||
@ -380,7 +370,7 @@ class PlayerAPI{
|
||||
"z" => $player->level->getSpawn()->z,
|
||||
));
|
||||
}
|
||||
$this->server->query("INSERT OR REPLACE INTO players (clientID, ip, port, name) VALUES (".$player->clientID.", '".$player->ip."', ".$player->port.", '".strtolower($player->username)."');");
|
||||
$this->server->query("INSERT OR REPLACE INTO players (CID, ip, port, name) VALUES (".$player->CID.", '".$player->ip."', ".$player->port.", '".strtolower($player->username)."');");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ class Player{
|
||||
$this->server = ServerAPI::request();
|
||||
$this->lastBreak = microtime(true);
|
||||
$this->clientID = $clientID;
|
||||
$this->CID = $this->server->clientID($ip, $port);
|
||||
$this->CID = PocketMinecraftServer::clientID($ip, $port);
|
||||
$this->ip = $ip;
|
||||
$this->port = $port;
|
||||
$this->spawnPosition = $this->server->spawn;
|
||||
@ -1050,13 +1050,13 @@ class Player{
|
||||
}
|
||||
$this->entity = $this->server->api->entity->add($this->level, ENTITY_PLAYER, 0, array("player" => $this));
|
||||
$this->eid = $this->entity->eid;
|
||||
$this->server->query("UPDATE players SET EID = ".$this->eid." WHERE clientID = ".$this->clientID.";");
|
||||
$this->server->query("UPDATE players SET EID = ".$this->eid." WHERE CID = ".$this->CID.";");
|
||||
$this->entity->x = $this->data->get("position")["x"];
|
||||
$this->entity->y = $this->data->get("position")["y"];
|
||||
$this->entity->z = $this->data->get("position")["z"];
|
||||
$this->entity->check = false;
|
||||
$this->entity->setName($this->username);
|
||||
$this->entity->data["clientID"] = $this->clientID;
|
||||
$this->entity->data["CID"] = $this->CID;
|
||||
$this->evid[] = $this->server->event("server.chat", array($this, "eventHandler"));
|
||||
$this->evid[] = $this->server->event("entity.remove", array($this, "eventHandler"));
|
||||
$this->evid[] = $this->server->event("entity.move", array($this, "eventHandler"));
|
||||
|
@ -117,7 +117,7 @@ class PocketMinecraftServer{
|
||||
$this->query("PRAGMA journal_mode = OFF;");
|
||||
$this->query("PRAGMA encoding = \"UTF-8\";");
|
||||
$this->query("PRAGMA secure_delete = OFF;");
|
||||
$this->query("CREATE TABLE players (clientID INTEGER PRIMARY KEY, EID NUMERIC, ip TEXT, port NUMERIC, name TEXT UNIQUE COLLATE NOCASE);");
|
||||
$this->query("CREATE TABLE players (CID INTEGER PRIMARY KEY, EID NUMERIC, ip TEXT, port NUMERIC, name TEXT UNIQUE COLLATE NOCASE);");
|
||||
$this->query("CREATE TABLE entities (EID INTEGER PRIMARY KEY, level TEXT, type NUMERIC, class NUMERIC, hasUpdate NUMERIC, name TEXT, x NUMERIC, y NUMERIC, z NUMERIC, yaw NUMERIC, pitch NUMERIC, health NUMERIC);");
|
||||
$this->query("CREATE TABLE tiles (ID INTEGER PRIMARY KEY, level TEXT, class TEXT, x NUMERIC, y NUMERIC, z NUMERIC, spawnable NUMERIC);");
|
||||
$this->query("CREATE TABLE actions (ID INTEGER PRIMARY KEY, interval NUMERIC, last NUMERIC, code TEXT, repeat NUMERIC);");
|
||||
|
Loading…
x
Reference in New Issue
Block a user