From 991436993f47ba7593ba4a052672fca52bf2fcbc Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Wed, 15 May 2013 18:38:20 +0200 Subject: [PATCH] Fixed things --- src/API/BanAPI.php | 2 +- src/Player.php | 19 ++++++++++++++----- src/network/RCON.php | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/API/BanAPI.php b/src/API/BanAPI.php index 279bc06dc..e9bc1a458 100644 --- a/src/API/BanAPI.php +++ b/src/API/BanAPI.php @@ -326,7 +326,7 @@ class BanAPI{ $username = strtolower($username); if($this->isOp($username)){ return true; - }elseif($this->server->api->dhandle("api.ban.whitelist.check", $ip) === false){ + }elseif($this->server->api->dhandle("api.ban.whitelist.check", $username) === false){ return true; }elseif($this->whitelist->exists($username)){ return true; diff --git a/src/Player.php b/src/Player.php index d902307a1..a90decedc 100644 --- a/src/Player.php +++ b/src/Player.php @@ -576,11 +576,6 @@ class Player{ if($pitch === false){ $pitch = $this->entity->yaw; } - if($pos instanceof Position and $pos->level !== $this->level){ - $this->level = $pos->level; - $this->chunksLoaded = array(); - $terrain = true; - } $this->lastCorrect = $pos; $this->entity->fallY = false; $this->entity->fallStart = false; @@ -588,6 +583,20 @@ class Player{ $this->entity->resetSpeed(); $this->entity->updateLast(); $this->entity->calculateVelocity(); + if($pos instanceof Position and $pos->level !== $this->level){ + foreach($this->server->api->entity->getAll($this->level) as $e){ + if($e !== $this->entity){ + $this->dataPacket(MC_REMOVE_ENTITY, array( + "eid" => $e->eid, + )); + } + } + $this->level = $pos->level; + $this->chunksLoaded = array(); + $this->server->api->entity->spawnToAll($this->level, $this->eid); + $this->server->api->entity->spawnAll($this); + $terrain = true; + } if($terrain === true){ $this->orderChunks(); $this->getNextChunk(); diff --git a/src/network/RCON.php b/src/network/RCON.php index 08310c58a..16541169b 100644 --- a/src/network/RCON.php +++ b/src/network/RCON.php @@ -123,7 +123,7 @@ class RCONInstance extends Thread{ } @socket_set_block($client); $size = Utils::readLInt($d); - if($size < 0){ + if($size < 0 or $size > 65535){ return false; } $requestID = Utils::readLInt(socket_read($client, 4));