mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-14 23:45:34 +00:00
Don't fire events in different worlds
This commit is contained in:
parent
9e55de134f
commit
3fca7ab6a5
@ -375,7 +375,7 @@ class Player{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->dataPacket(MC_PLAYER_ARMOR_EQUIPMENT, $data);
|
$this->dataPacket(MC_PLAYER_ARMOR_EQUIPMENT, $data);
|
||||||
}else{
|
}elseif($data["player"]->level === $this->level){
|
||||||
$this->dataPacket(MC_PLAYER_ARMOR_EQUIPMENT, $data);
|
$this->dataPacket(MC_PLAYER_ARMOR_EQUIPMENT, $data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -386,15 +386,16 @@ class Player{
|
|||||||
if(($this->gamemode & 0x01) === 0x00){
|
if(($this->gamemode & 0x01) === 0x00){
|
||||||
$this->addItem($data["entity"]->type, $data["entity"]->meta, $data["entity"]->stack);
|
$this->addItem($data["entity"]->type, $data["entity"]->meta, $data["entity"]->stack);
|
||||||
}
|
}
|
||||||
}else{
|
}elseif($data["entity"]->level === $this->level){
|
||||||
$this->dataPacket(MC_TAKE_ITEM_ENTITY, $data);
|
$this->dataPacket(MC_TAKE_ITEM_ENTITY, $data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "player.equipment.change":
|
case "player.equipment.change":
|
||||||
if($data["eid"] === $this->eid){
|
if($data["eid"] === $this->eid or $data["player"]->level !== $this->level){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$this->dataPacket(MC_PLAYER_EQUIPMENT, $data);
|
$this->dataPacket(MC_PLAYER_EQUIPMENT, $data);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "block.change":
|
case "block.change":
|
||||||
if($data["position"]->level !== $this->level){
|
if($data["position"]->level !== $this->level){
|
||||||
@ -409,7 +410,7 @@ class Player{
|
|||||||
));
|
));
|
||||||
break;
|
break;
|
||||||
case "entity.move":
|
case "entity.move":
|
||||||
if($data->eid === $this->eid){
|
if($data->eid === $this->eid or $data->level !== $this->level){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$this->dataPacket(MC_MOVE_ENTITY_POSROT, array(
|
$this->dataPacket(MC_MOVE_ENTITY_POSROT, array(
|
||||||
@ -422,7 +423,7 @@ class Player{
|
|||||||
));
|
));
|
||||||
break;
|
break;
|
||||||
case "entity.motion":
|
case "entity.motion":
|
||||||
/*if($data->eid === $this->eid){
|
/*if($data->eid === $this->eid or $data->level !== $this->level){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$this->dataPacket(MC_SET_ENTITY_MOTION, array(
|
$this->dataPacket(MC_SET_ENTITY_MOTION, array(
|
||||||
@ -433,7 +434,7 @@ class Player{
|
|||||||
));
|
));
|
||||||
break;*/
|
break;*/
|
||||||
case "entity.remove":
|
case "entity.remove":
|
||||||
if($data->eid === $this->eid){
|
if($data->eid === $this->eid or $data->level !== $this->level){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$this->dataPacket(MC_REMOVE_ENTITY, array(
|
$this->dataPacket(MC_REMOVE_ENTITY, array(
|
||||||
@ -446,7 +447,7 @@ class Player{
|
|||||||
));
|
));
|
||||||
break;
|
break;
|
||||||
case "entity.animate":
|
case "entity.animate":
|
||||||
if($data["eid"] === $this->eid){
|
if($data["eid"] === $this->eid or $data["entity"]->level !== $this->level){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$this->dataPacket(MC_ANIMATE, array(
|
$this->dataPacket(MC_ANIMATE, array(
|
||||||
@ -460,10 +461,12 @@ class Player{
|
|||||||
}else{
|
}else{
|
||||||
$eid = $data->eid;
|
$eid = $data->eid;
|
||||||
}
|
}
|
||||||
$this->dataPacket(MC_SET_ENTITY_DATA, array(
|
if($data->level === $this->level){
|
||||||
"eid" => $eid,
|
$this->dataPacket(MC_SET_ENTITY_DATA, array(
|
||||||
"metadata" => $data->getMetadata(),
|
"eid" => $eid,
|
||||||
));
|
"metadata" => $data->getMetadata(),
|
||||||
|
));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "entity.event":
|
case "entity.event":
|
||||||
if($data["entity"]->eid === $this->eid){
|
if($data["entity"]->eid === $this->eid){
|
||||||
@ -471,10 +474,12 @@ class Player{
|
|||||||
}else{
|
}else{
|
||||||
$eid = $data["entity"]->eid;
|
$eid = $data["entity"]->eid;
|
||||||
}
|
}
|
||||||
$this->dataPacket(MC_ENTITY_EVENT, array(
|
if($data["entity"]->level === $this->level){
|
||||||
"eid" => $eid,
|
$this->dataPacket(MC_ENTITY_EVENT, array(
|
||||||
"event" => $data["event"],
|
"eid" => $eid,
|
||||||
));
|
"event" => $data["event"],
|
||||||
|
));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "server.chat":
|
case "server.chat":
|
||||||
if(($data instanceof Container) === true){
|
if(($data instanceof Container) === true){
|
||||||
@ -1090,7 +1095,7 @@ class Player{
|
|||||||
if($this->spawned === false){
|
if($this->spawned === false){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$this->server->api->dhandle("entity.animate", array("eid" => $this->eid, "action" => $data["action"]));
|
$this->server->api->dhandle("entity.animate", array("eid" => $this->eid, "entity" => $this->entity, "action" => $data["action"]));
|
||||||
break;
|
break;
|
||||||
case MC_RESPAWN:
|
case MC_RESPAWN:
|
||||||
if($this->spawned === false){
|
if($this->spawned === false){
|
||||||
@ -1260,7 +1265,7 @@ class Player{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function sendArmor(){
|
public function sendArmor(){
|
||||||
$this->server->api->dhandle("player.armor", array("eid" => $this->eid, "slot0" => ($this->armor[0][0] > 0 ? ($this->armor[0][0] - 256):AIR), "slot1" => ($this->armor[1][0] > 0 ? ($this->armor[1][0] - 256):AIR), "slot2" => ($this->armor[2][0] > 0 ? ($this->armor[2][0] - 256):AIR), "slot3" => ($this->armor[3][0] > 0 ? ($this->armor[3][0] - 256):AIR)));
|
$this->server->api->dhandle("player.armor", array("player" => $this, "eid" => $this->eid, "slot0" => ($this->armor[0][0] > 0 ? ($this->armor[0][0] - 256):AIR), "slot1" => ($this->armor[1][0] > 0 ? ($this->armor[1][0] - 256):AIR), "slot2" => ($this->armor[2][0] > 0 ? ($this->armor[2][0] - 256):AIR), "slot3" => ($this->armor[3][0] > 0 ? ($this->armor[3][0] - 256):AIR)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendInventory(){
|
public function sendInventory(){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user