Why I do $player->getLevel()->addSound(new FizzSound(new Vector3($player->x, $player->y, $player->z)), $this->getServer()->getOnlinePlayers()); and nothing happens?
Note that $player itself is already a Vector3 and you don't need to construct another one. Also, the constructor is inherited from Vector3, so it is new FizzSound($x. $y, $z)
Used your solution, but Code: [Server] 14:35:13 [INFO] hoyinm[/192.168.0.102:43167] logged in with entity id 1 at (FACTIONS, 5.0731, 76, -89.4601) [Server] 14:35:15 [INFO] There are 1/100 players online: hoyinm [Server] 14:35:31 [INFO] Welcome hoyinm to the server! [Server] 14:35:35 [CRITICAL] "Could not pass event 'pocketmine\event\player\PlayerCommandPreprocessEvent' to 'AuthMePE v0.1.7_beta': Argument 1 passed to pocketmine\level\sound\FizzSound::__construct() must be an instance of pocketmine\math\Vector3, string given, called in /storage/emulated/0/PocketMine/plugins/AuthMePE-master/src/AuthMePE/AuthMePE.php on line 127 and defined on AuthMePE\AuthMePE [Server] 14:35:35 [NOTICE] InvalidArgumentException: "Argument 1 passed to pocketmine\level\sound\FizzSound::__construct() must be an instance of pocketmine\math\Vector3, string given, called in /storage/emulated/0/PocketMine/plugins/AuthMePE-master/src/AuthMePE/AuthMePE.php on line 127 and defined" (E_RECOVERABLE_ERROR) in "/src/pocketmine/level/sound/FizzSound" at line 27 [Server] 14:35:35 [INFO] hoyinm: gordon [Server] 14:35:37 [INFO] hoyinm left the game [Server] 14:35:37 [INFO] hoyinm[/192.168.0.102:43167] logged out due to client disconnect [Server] 14:35:37 [INFO] There are 0/100 players online:
Yup Didn't you want to send a Sound to everyone? If yes, try PHP: foreach($this->getServer()->getOnlinePlayers() as $player){ $level->addSound(new FizzSound($player->getLocation()))}
Seems like you did not even read the API usage and just tried to use something without knowing what it means. First of all, Player (and other entities) extends Position, which extends Vector3. getLocation() is redundant and wasteful. Second, you have a parameter for the list of players to send this sound, if null, will get the players that view the current chunk for the sound. This will send EACH online player the sounds from ALL the other players. If there are 80 players at the same time... 80 sounds in the same tick. Just imagine how that sounds, and it might even crash your device. This is why plugin developers should read the API docs seriously, otherwise your plugin can be the bottleneck of the entire system. By the way: PHP: //Send a sound to all online players originating from location (can be any kind of vector3, entity or player object)$level->addSound(new FizzSound($player), $this->getServer()->getOnlinePlayers());//Send a sound to nearby players (this might be what you want, so it won't go on different levels and/or regions of the world)$level->addSound(new FizzSound($player));