mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-19 15:35:52 +00:00
Replace player spaces & handle more data packets
This commit is contained in:
parent
9ebe68294b
commit
683c05f206
@ -76,7 +76,7 @@ class Entity extends stdClass{
|
||||
}
|
||||
|
||||
public function update(){
|
||||
if($this->class === ENTITY_ITEM){
|
||||
if($this->class === ENTITY_ITEM and $this->closed === false){
|
||||
$this->server->api->dhandle("entity.move", $this->eid);
|
||||
$player = $this->server->query("SELECT EID FROM entities WHERE class == ".ENTITY_PLAYER." AND abs(x - {$this->x}) <= 1.5 AND abs(y - {$this->y}) <= 1.5 AND abs(z - {$this->z}) <= 1.5 LIMIT 1;", true);
|
||||
if($player !== true and $player !== false){
|
||||
@ -166,7 +166,7 @@ class Entity extends stdClass{
|
||||
$this->server->query("DELETE FROM entities WHERE EID = ".$this->eid.";");
|
||||
$this->server->api->dhandle("entity.remove", $this->eid);
|
||||
$this->closed = true;
|
||||
unset($this);
|
||||
$this->__destruct();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,9 +213,21 @@ class Player{
|
||||
));
|
||||
break;
|
||||
case 0x80:
|
||||
case 0x81:
|
||||
case 0x82:
|
||||
case 0x83:
|
||||
case 0x84:
|
||||
case 0x85:
|
||||
case 0x86:
|
||||
case 0x87:
|
||||
case 0x88:
|
||||
case 0x89:
|
||||
case 0x8a:
|
||||
case 0x8b:
|
||||
case 0x8c:
|
||||
case 0x8d:
|
||||
case 0x8e:
|
||||
case 0x8f:
|
||||
if(isset($data[0])){
|
||||
$diff = $data[0] - $this->counter[1];
|
||||
if($diff > 1){ //Packet recovery
|
||||
@ -244,7 +256,7 @@ class Player{
|
||||
|
||||
break;
|
||||
case MC_LOGIN:
|
||||
$this->username = str_replace("/", "", $data["username"]);
|
||||
$this->username = str_replace(array("\x00", "/", " ", "\r", "\n"), array("", "-", "_", "", ""), $data["username"]);
|
||||
if($this->username == ""){
|
||||
$this->close("bad username", false);
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user