diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 73741592c..aabaddd33 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -166,7 +166,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ protected $forceMovement = null; protected $connected = true; protected $ip; - protected $removeFormat = false; + protected $removeFormat = true; protected $port; protected $username; protected $iusername; @@ -2397,9 +2397,6 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ * @param string $message */ public function sendMessage($message){ - if($this->removeFormat !== false){ - $message = TextFormat::clean($message); - } $mes = explode("\n", $message); foreach($mes as $m){ if($m !== ""){ @@ -2412,13 +2409,6 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ } public function sendTranslation($message, array $parameters = []){ - if($this->removeFormat !== false){ - $message = TextFormat::clean($message); - foreach($parameters as $k => $v){ - $parameters[$k] = TextFormat::clean($v); - } - } - $pk = new TextPacket(); $pk->type = TextPacket::TYPE_TRANSLATION; $pk->message = $message; diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 03dcbf6e2..03f3d7ff6 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -97,6 +97,7 @@ use pocketmine\utils\Random; use pocketmine\utils\ReversePriorityQueue; use pocketmine\utils\TextFormat; use pocketmine\level\particle\Particle; +use pocketmine\level\sound\Sound; use pocketmine\level\particle\DestroyBlockParticle; #include @@ -368,6 +369,24 @@ class Level implements ChunkManager, Metadatable{ $this->temporalPosition = null; } + public function addSound(Sound $sound, array $players = null){ + $pk = $sound->encode(); + + if($players === null){ + $players = $this->getUsingChunk($sound->x >> 4, $sound->z >> 4); + } + + if($pk !== null){ + if(!is_array($pk)){ + Server::broadcastPacket($players, $pk); + }else{ + foreach($pk as $p){ + Server::broadcastPacket($players, $p); + } + } + } + } + public function addParticle(Particle $particle, array $players = null){ $pk = $particle->encode(); diff --git a/src/pocketmine/level/sound/BatSound.php b/src/pocketmine/level/sound/BatSound.php new file mode 100644 index 000000000..1a18d5785 --- /dev/null +++ b/src/pocketmine/level/sound/BatSound.php @@ -0,0 +1,30 @@ +x, $pos->y, $pos->z); + $this->id = (int) $id; + $this->pitch = (float) $pitch * 1000; + } + + protected $pitch = 0; + protected $id; + + public function getPitch(){ + return $this->pitch / 1000; + } + + public function setPitch($pitch){ + $this->pitch = (float) $pitch * 1000; + } + + + public function encode(){ + $pk = new LevelEventPacket; + $pk->evid = $this->id; + $pk->x = $this->x; + $pk->y = $this->y; + $pk->z = $this->z; + $pk->data = (int) $this->pitch; + + return $pk; + } + +} diff --git a/src/pocketmine/level/sound/LaunchSound.php b/src/pocketmine/level/sound/LaunchSound.php new file mode 100644 index 000000000..74e00729c --- /dev/null +++ b/src/pocketmine/level/sound/LaunchSound.php @@ -0,0 +1,30 @@ +