mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 02:09:42 +00:00
Removed time stopping fields from SetTimePacket and fixed #526
TODO: rules
This commit is contained in:
parent
022f33b256
commit
894beed59b
@ -763,10 +763,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
}
|
||||
|
||||
$this->usedChunks = [];
|
||||
$pk = new SetTimePacket();
|
||||
$pk->time = $this->level->getTime();
|
||||
$pk->started = $this->level->stopTime == false;
|
||||
$this->dataPacket($pk);
|
||||
$this->level->sendTime($this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -884,11 +881,6 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
$this->inventory->sendArmorContents($this);
|
||||
$this->inventory->sendHeldItem($this);
|
||||
|
||||
$pk = new SetTimePacket();
|
||||
$pk->time = $this->level->getTime();
|
||||
$pk->started = $this->level->stopTime == false;
|
||||
$this->dataPacket($pk);
|
||||
|
||||
$pos = $this->level->getSafeSpawn($this);
|
||||
|
||||
$this->server->getPluginManager()->callEvent($ev = new PlayerRespawnEvent($this, $pos));
|
||||
@ -1843,10 +1835,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
$pk->worldName = $this->server->getMotd();
|
||||
$this->dataPacket($pk);
|
||||
|
||||
$pk = new SetTimePacket();
|
||||
$pk->time = $this->level->getTime();
|
||||
$pk->started = $this->level->stopTime == false;
|
||||
$this->dataPacket($pk);
|
||||
$this->level->sendTime($this);
|
||||
|
||||
$this->sendAttributes(true);
|
||||
$this->setNameTagVisible(true);
|
||||
|
@ -628,13 +628,14 @@ class Level implements ChunkManager, Metadatable{
|
||||
/**
|
||||
* WARNING: Do not use this, it's only for internal use.
|
||||
* Changes to this function won't be recorded on the version.
|
||||
*
|
||||
* @param Player ...$targets If empty, will send to all players in the level.
|
||||
*/
|
||||
public function sendTime(){
|
||||
public function sendTime(Player ...$targets){
|
||||
$pk = new SetTimePacket();
|
||||
$pk->time = (int) $this->time;
|
||||
$pk->started = $this->stopTime == false;
|
||||
|
||||
$this->server->broadcastPacket($this->players, $pk);
|
||||
$this->server->broadcastPacket(count($targets) > 0 ? $targets : $this->players, $pk);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,7 +29,6 @@ class SetTimePacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::SET_TIME_PACKET;
|
||||
|
||||
public $time;
|
||||
public $started = true;
|
||||
|
||||
public function decode(){
|
||||
|
||||
@ -38,7 +37,6 @@ class SetTimePacket extends DataPacket{
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putVarInt($this->time);
|
||||
$this->putBool($this->started);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
|
Loading…
x
Reference in New Issue
Block a user