Improved Player::blocked

This commit is contained in:
Shoghi Cervantes
2013-06-12 13:46:44 +02:00
parent ff7fa066a5
commit c83d4d955f
2 changed files with 10 additions and 16 deletions

View File

@ -238,7 +238,7 @@ class ConsoleAPI{
if($this->server->api->dhandle("console.command.".$cmd, array("cmd" => $cmd, "parameters" => $params, "issuer" => $issuer, "alias" => $alias)) === false if($this->server->api->dhandle("console.command.".$cmd, array("cmd" => $cmd, "parameters" => $params, "issuer" => $issuer, "alias" => $alias)) === false
or $this->server->api->dhandle("console.command", array("cmd" => $cmd, "parameters" => $params, "issuer" => $issuer, "alias" => $alias)) === false){ or $this->server->api->dhandle("console.command", array("cmd" => $cmd, "parameters" => $params, "issuer" => $issuer, "alias" => $alias)) === false){
$output = "You don't have permission to use this command.\n"; $output = "You don't have permissions to use this command.\n";
}else{ }else{
if(isset($this->cmds[$cmd]) and is_callable($this->cmds[$cmd])){ if(isset($this->cmds[$cmd]) and is_callable($this->cmds[$cmd])){
$output = @call_user_func($this->cmds[$cmd], $cmd, $params, $issuer, $alias); $output = @call_user_func($this->cmds[$cmd], $cmd, $params, $issuer, $alias);

View File

@ -1213,12 +1213,9 @@ class Player{
} }
break; break;
case MC_REQUEST_CHUNK: case MC_REQUEST_CHUNK:
if($this->spawned === false){
break;
}
break; break;
case MC_USE_ITEM: case MC_USE_ITEM:
if($this->spawned === false){ if($this->spawned === false or $this->blocked === true){
break; break;
} }
$this->craftingItems = array(); $this->craftingItems = array();
@ -1261,7 +1258,7 @@ class Player{
} }
break; break;
case MC_PLAYER_ACTION: case MC_PLAYER_ACTION:
if($this->spawned === false){ if($this->spawned === false or $this->blocked === true){
break; break;
} }
$this->craftingItems = array(); $this->craftingItems = array();
@ -1289,10 +1286,7 @@ class Player{
$this->entity->updateMetadata(); $this->entity->updateMetadata();
break; break;
case MC_REMOVE_BLOCK: case MC_REMOVE_BLOCK:
if($this->spawned === false){ if($this->spawned === false or $this->blocked === true or $this->entity->distance(new Vector3($data["x"], $data["y"], $data["z"])) > 8){
break;
}
if($this->blocked === true or $this->entity->distance(new Vector3($data["x"], $data["y"], $data["z"])) > 8){
break; break;
} }
$this->craftingItems = array(); $this->craftingItems = array();
@ -1300,7 +1294,7 @@ class Player{
$this->server->api->block->playerBlockBreak($this, new Vector3($data["x"], $data["y"], $data["z"])); $this->server->api->block->playerBlockBreak($this, new Vector3($data["x"], $data["y"], $data["z"]));
break; break;
case MC_PLAYER_ARMOR_EQUIPMENT: case MC_PLAYER_ARMOR_EQUIPMENT:
if($this->spawned === false){ if($this->spawned === false or $this->blocked === true){
break; break;
} }
$this->craftingItems = array(); $this->craftingItems = array();
@ -1333,7 +1327,7 @@ class Player{
} }
break; break;
case MC_INTERACT: case MC_INTERACT:
if($this->spawned === false){ if($this->spawned === false or $this->blocked === true){
break; break;
} }
$this->craftingItems = array(); $this->craftingItems = array();
@ -1442,7 +1436,7 @@ class Player{
case MC_SET_HEALTH: //Not used case MC_SET_HEALTH: //Not used
break; break;
case MC_ENTITY_EVENT: case MC_ENTITY_EVENT:
if($this->spawned === false){ if($this->spawned === false or $this->blocked === true){
break; break;
} }
$this->craftingItems = array(); $this->craftingItems = array();
@ -1486,7 +1480,7 @@ class Player{
} }
break; break;
case MC_DROP_ITEM: case MC_DROP_ITEM:
if($this->spawned === false){ if($this->spawned === false or $this->blocked === true){
break; break;
} }
$this->craftingItems = array(); $this->craftingItems = array();
@ -1502,7 +1496,7 @@ class Player{
} }
break; break;
case MC_SIGN_UPDATE: case MC_SIGN_UPDATE:
if($this->spawned === false){ if($this->spawned === false or $this->blocked === true){
break; break;
} }
$this->craftingItems = array(); $this->craftingItems = array();
@ -1545,7 +1539,7 @@ class Player{
)); ));
break; break;
case MC_CONTAINER_SET_SLOT: case MC_CONTAINER_SET_SLOT:
if($this->spawned === false){ if($this->spawned === false or $this->blocked === true){
break; break;
} }