Fixed White-listing and IP ban

This commit is contained in:
Shoghi Cervantes Pueyo
2012-12-08 17:05:52 +01:00
parent 2116702d43
commit ed8f38ef55
2 changed files with 60 additions and 18 deletions

View File

@ -69,7 +69,8 @@ class Session{
file_put_contents(FILE_PATH."data/players/".str_replace("/", "", $this->username).".dat", serialize($this->data));
}
public function close($reason = "server stop", $msg = true){
public function close($reason = "", $msg = true){
$reason = $reason == "" ? "server stop":$reason;
$this->save();
if(is_object($this->entity)){
$this->entity->close();
@ -77,6 +78,7 @@ class Session{
foreach($this->evid as $ev){
$this->server->deleteEvent($ev[0], $ev[1]);
}
$this->eventHandler("You have been kicked. Reason: ".$reason, "onChat");
$this->connected = false;
if($msg === true){
$this->server->trigger("onChat", $this->username." left the game");
@ -292,6 +294,7 @@ class Session{
console("[DEBUG] Player with EID ".$this->eid." \"".$this->username."\" spawned!", true, true, 2);
$this->entity = new Entity($this->eid, ENTITY_PLAYER, 0, $this->server);
$this->entity->setName($this->username);
$this->entity->setHealth($this->data["health"]);
$this->entity->data["clientID"] = $this->clientID;
$this->server->entities[$this->eid] = &$this->entity;
$this->server->trigger("onPlayerAdd", array(