Huge commit (Block API, changed events)

Changed Session to Player
Block API
Block Data
This commit is contained in:
Shoghi Cervantes Pueyo
2012-12-24 00:44:13 +01:00
parent e47bacce74
commit b867ba559e
10 changed files with 311 additions and 102 deletions

View File

@ -121,7 +121,7 @@ class Entity extends stdClass{
public function close(){
if($this->closed === false){
$this->server->query("DELETE FROM entities WHERE EID = ".$this->eid.";");
$this->server->trigger("onEntityRemove", $this->eid);
$this->server->trigger("entity.remove", $this->eid);
$this->closed = true;
}
}
@ -186,7 +186,7 @@ class Entity extends stdClass{
public function setHealth($health, $cause = ""){
$this->health = (int) $health;
$this->server->query("UPDATE entities SET health = ".$this->health." WHERE EID = ".$this->eid.";");
$this->server->trigger("onHealthChange", array("eid" => $this->eid, "health" => $health, "cause" => $cause));
$this->server->trigger("entity.health.change", array("eid" => $this->eid, "health" => $health, "cause" => $cause));
if($this->player !== false){
$this->player->dataPacket(MC_SET_HEALTH, array(
"health" => $this->health,