PlayerAPI::remove removes a player from the table by his clientID, packets wont be handled after the player was kicked due to player already ingame

This commit is contained in:
GameHerobrine 2025-07-17 05:27:15 +03:00
parent bbe9e0ee13
commit ba4ccafa32
3 changed files with 8 additions and 3 deletions

View file

@ -521,7 +521,11 @@ class PlayerAPI{
if($player->username != "" and ($player->data instanceof Config)){
$this->saveOffline($player->data);
}
$this->server->query("DELETE FROM players WHERE name = '" . $player->username . "';");
$this->server->preparedSQL->player->deleteCID->reset();
$this->server->preparedSQL->player->deleteCID->bindValue(":CID", $CID);
$this->server->preparedSQL->player->getEq->execute();
$this->server->api->entity->remove($player->eid);
unset($player->level->players[$player->CID]);
if($player->entity instanceof Entity){

View file

@ -2115,8 +2115,8 @@ class Player{
}
$u = $this->server->api->player->get($this->iusername, false);
if($u !== false){
$u = $this->server->clients[$this->CID];
$u->close("this player already in game");
$this->close("this player already in game");
return;
}
$this->server->api->player->add($this->CID);

View file

@ -176,6 +176,7 @@ class PocketMinecraftServer{
$this->preparedSQL->entity->setPosition = $this->database->prepare("UPDATE entities SET x = :x, y = :y, z = :z, pitch = :pitch, yaw = :yaw WHERE EID = :eid ;");
$this->preparedSQL->entity->setLevel = $this->database->prepare("UPDATE entities SET level = :level WHERE EID = :eid ;");
$this->preparedSQL->player->deleteCID = $this->database->prepare("DELETE FROM players WHERE CID = :cid;");
$this->preparedSQL->player->getEq = $this->database->prepare("SELECT ip,port,name FROM players WHERE name = :name;"); //'$name'
$this->preparedSQL->player->getLike = $this->database->prepare("SELECT ip,port,name FROM players WHERE name LIKE :name;"); //'$name'