mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Fixed player sounds not being broadcasted to the player itself
fixes #4259 fixes #4270
This commit is contained in:
parent
5d6146a01f
commit
60d80e173b
@ -105,6 +105,7 @@ use pocketmine\world\Position;
|
||||
use pocketmine\world\sound\EntityAttackNoDamageSound;
|
||||
use pocketmine\world\sound\EntityAttackSound;
|
||||
use pocketmine\world\sound\FireExtinguishSound;
|
||||
use pocketmine\world\sound\Sound;
|
||||
use pocketmine\world\World;
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
use function abs;
|
||||
@ -2221,6 +2222,14 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
parent::broadcastAnimation($animation, $targets);
|
||||
}
|
||||
|
||||
public function broadcastSound(Sound $sound, ?array $targets = null) : void{
|
||||
if($this->spawned && $targets === null){
|
||||
$targets = $this->getViewers();
|
||||
$targets[] = $this;
|
||||
}
|
||||
parent::broadcastSound($sound, $targets);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: remove this
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user