diff --git a/TODO.md b/TODO.md index 3b0fca31..4ba5a6c9 100644 --- a/TODO.md +++ b/TODO.md @@ -14,7 +14,6 @@ __Check Milestones [here](https://github.com/shoghicp/PocketMine-MP/issues/miles ## Alpha (full Creative) - Random Chunk Updates - Water/lava spread -- Fix spawn position resetting - Correct block placement for beds - Correct chest/furnace placement - Players can often hear "echos" of their own block interactions' SFX (torch placed, block destroyed, etc. most noticeable when moving around as you place.) diff --git a/classes/API/PlayerAPI.php b/classes/API/PlayerAPI.php index d437422e..00d53003 100644 --- a/classes/API/PlayerAPI.php +++ b/classes/API/PlayerAPI.php @@ -199,7 +199,7 @@ class PlayerAPI{ ), "health" => 20, "lastIP" => "", - "lastID" => "", + "lastID" => 0, ); $this->saveOffline($name, $data); }else{ diff --git a/classes/Player.class.php b/classes/Player.class.php index 7bc3264e..4feea0a0 100644 --- a/classes/Player.class.php +++ b/classes/Player.class.php @@ -239,6 +239,15 @@ class Player{ break; case MC_LOGIN: $this->username = str_replace("/", "", $data["username"]); + if($this->username == ""){ + $this->close("bad username", false); + break; + } + $o = $this->server->api->player->getOffline($this->username); + if($this->server->whitelist !== false and (!in_array($this->username, $this->server->whitelist) or ($o["lastID"] != 0 and $o["lastID"] != $this->clientID))){ + $this->close("\"".$this->username."\" not being on white-list", false); + break; + } $u = $this->server->api->player->get($this->username); $c = $this->server->api->player->getByClientID($this->clientID); if($u !== false){ @@ -247,10 +256,6 @@ class Player{ if($c !== false){ $c->close("logged in from another location"); } - if($this->server->whitelist !== false and !in_array($this->username, $this->server->whitelist)){ - $this->close("\"".$this->username."\" not being on white-list", false); - break; - } $this->server->api->player->add($this->CID); $this->auth = true; $this->data["lastIP"] = $this->ip;