Last active
November 12, 2016 14:42
-
-
Save PEMapModder/7ce437f0c66473711c6e to your computer and use it in GitHub Desktop.
ChatPopSound - Auto-generated gist plugin stub by pmt.mcpe.me InstaPlugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: ChatPopSound | |
author: PEMapModder | |
version: "1.0" | |
api: | |
- 1.12.0 | |
main: PEMapModder\ChatPopSound\Main | |
commands: [] | |
permissions: [] | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace PEMapModder\ChatPopSound; | |
use pocketmine\event\player\PlayerChatEvent; | |
use pocketmine\event\Listener; | |
use pocketmine\level\sound\PopSound; | |
use pocketmine\plugin\PluginBase; | |
class Main extends PluginBase implements Listener{ | |
public function onEnable(){ | |
$this->getServer()->getPluginManager()->registerEvents($this, $this); | |
} | |
public function onChat(PlayerChatEvent $event){ | |
$level = $event->getPlayer()->getLevel(); | |
foreach($this->getServer()->getOnlinePlayers() as $player){ | |
$level->addSound(new PopSound($player), $player); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment