mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Level: Allow broadcastLevelEvent() to accept a null position to broadcast to everyone in the Level
This commit is contained in:
parent
f0696f77ef
commit
ecb3f9aeac
@ -503,16 +503,21 @@ class Level implements ChunkManager, Metadatable{
|
||||
/**
|
||||
* Broadcasts a LevelEvent to players in the area. This could be sound, particles, weather changes, etc.
|
||||
*
|
||||
* @param Vector3 $pos
|
||||
* @param int $evid
|
||||
* @param int $data
|
||||
* @param Vector3|null $pos If null, broadcasts to every player in the Level
|
||||
* @param int $evid
|
||||
* @param int $data
|
||||
*/
|
||||
public function broadcastLevelEvent(Vector3 $pos, int $evid, int $data = 0){
|
||||
public function broadcastLevelEvent(?Vector3 $pos, int $evid, int $data = 0){
|
||||
$pk = new LevelEventPacket();
|
||||
$pk->evid = $evid;
|
||||
$pk->data = $data;
|
||||
$pk->position = $pos->asVector3();
|
||||
$this->addChunkPacket($pos->x >> 4, $pos->z >> 4, $pk);
|
||||
if($pos !== null){
|
||||
$pk->position = $pos->asVector3();
|
||||
$this->addChunkPacket($pos->x >> 4, $pos->z >> 4, $pk);
|
||||
}else{
|
||||
$pk->position = null;
|
||||
$this->addGlobalPacket($pk);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user