mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Packet broadcast to players
This commit is contained in:
parent
b9e3acd017
commit
48b5afac46
@ -440,13 +440,6 @@ class Player{
|
||||
"eid" => $data->eid,
|
||||
));
|
||||
break;
|
||||
case "time.change":
|
||||
if($data["level"] === $this->level){
|
||||
$this->dataPacket(MC_SET_TIME, array(
|
||||
"time" => $data["time"],
|
||||
));
|
||||
}
|
||||
break;
|
||||
case "entity.animate":
|
||||
if($data["eid"] === $this->eid or $data["entity"]->level !== $this->level){
|
||||
break;
|
||||
@ -912,7 +905,6 @@ class Player{
|
||||
$this->entity->z = $this->data->get("position")["z"];
|
||||
$this->entity->setName($this->username);
|
||||
$this->entity->data["clientID"] = $this->clientID;
|
||||
$this->evid[] = $this->server->event("time.change", array($this, "eventHandler"));
|
||||
$this->evid[] = $this->server->event("server.chat", array($this, "eventHandler"));
|
||||
$this->evid[] = $this->server->event("entity.remove", array($this, "eventHandler"));
|
||||
$this->evid[] = $this->server->event("entity.move", array($this, "eventHandler"));
|
||||
|
@ -449,6 +449,21 @@ class CustomPacketHandler{
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MC_LEVEL_EVENT:
|
||||
if($this->c === false){
|
||||
$this->data["unknown1"] = Utils::readShort($this->get(2));
|
||||
$this->data["unknown2"] = Utils::readShort($this->get(2));
|
||||
$this->data["unknown3"] = Utils::readShort($this->get(2));
|
||||
$this->data["unknown4"] = Utils::readShort($this->get(2));
|
||||
$this->data["unknown5"] = Utils::readInt($this->get(4));
|
||||
}else{
|
||||
$this->raw .= Utils::writeShort($this->data["unknown1"]);
|
||||
$this->raw .= Utils::writeShort($this->data["unknown2"]);
|
||||
$this->raw .= Utils::writeShort($this->data["unknown3"]);
|
||||
$this->raw .= Utils::writeShort($this->data["unknown4"]);
|
||||
$this->raw .= Utils::writeInt($this->data["unknown5"]);
|
||||
}
|
||||
break;
|
||||
case MC_ENTITY_EVENT:
|
||||
if($this->c === false){
|
||||
$this->data["eid"] = Utils::readInt($this->get(4));
|
||||
|
@ -63,14 +63,17 @@ class Level{
|
||||
}
|
||||
|
||||
public function checkThings(){
|
||||
$players = $this->server->api->player->getAll($this);
|
||||
$now = microtime(true);
|
||||
$time = $this->startTime + ($now - $this->startCheck) * 20;
|
||||
if($this->server->api->dhandle("time.change", array("level" => $this, "time" => $time)) !== false){
|
||||
$this->time = $time;
|
||||
$this->server->api->player->broadcastPacket($players, MC_SET_TIME, array(
|
||||
"time" => $this->time,
|
||||
));
|
||||
}
|
||||
|
||||
if(count($this->changedCount) > 0){
|
||||
$players = $this->server->api->player->getAll($this);
|
||||
arsort($this->changedCount);
|
||||
$resendChunks = array();
|
||||
foreach($this->changedCount as $index => $count){
|
||||
|
Loading…
x
Reference in New Issue
Block a user