Muirfield / bad-plugins

PocketMine Plugins that are not good enough to be hosted in plugins.pocketmine.net
GNU General Public License v2.0
23 stars 17 forks source link

help for LocalChat #15

Closed MrDoni98 closed 8 years ago

MrDoni98 commented 9 years ago

how to change the color of the message?

public function onChat(PlayerChatEvent $e){ if ($e->isCancelled()) return; $pw = $e->getPlayer(); // Non players are handled normally if (!($pw instanceof Player)) return; $msg = $e->getMessage(); if (substr($msg,0,1) == ":") { // This messages goes to everybody on the server... // no need to do much... if (!$this->access($pw,"localchat.broadcast.server")) { $e->setCancelled(); return; } $e->setMessage(substr($msg,1)); return; }

alejandroliu commented 9 years ago

For the normal chat message you need to do $e->setFormat.

On the other hand, it should be compatible with other chat plugins that define chat formats.

MrDoni98 commented 9 years ago

thank you very much