Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Color filter

Comments in 'Plugin Development' started by MineBuilderFR, Mar 12, 2016.

  1. MineBuilderFR
    Offline

    MineBuilderFR Active Member

    Joined:
    Mar 14, 2015
    Posts:
    56
    Minecraft User:
    MineBuilderFR
    Hello , I need help, I use the function $server- >broadcast() when a player chat . How to filter color ( § ) ?
  2. Vaivez66
    Offline

    Vaivez66 Notable Member Plugin Developer

    Joined:
    Jun 10, 2015
    Posts:
    402
    Plugins:
    2
    I don't get it. Could you explain better?
  3. MineBuilderFR
    Offline

    MineBuilderFR Active Member

    Joined:
    Mar 14, 2015
    Posts:
    56
    Minecraft User:
    MineBuilderFR
    When a Player chat It can use color (§) because I use $server->broadcastMessage() , I have cancel PlayerChatEvent and set $server->broadcastMessage($msgofplayer); , and m'y probleme is : How to disable color ?
  4. xBeastMode
    Offline

    xBeastMode Active Member

    Joined:
    Nov 27, 2015
    Posts:
    292
    PHP:
    public function onChat(PlayerChatEvent $e){
    $player $e->getPlayer();
    if(!
    $player->hasPermission("chat.color")){
    $e->setMessage(TextFormat::clean($e->getMessage(), true /*set to TRUE if you want to disable bold or italic*/));
    }
    }
    PEMapModder and Legoboy0215 like this.
  5. MineBuilderFR
    Offline

    MineBuilderFR Active Member

    Joined:
    Mar 14, 2015
    Posts:
    56
    Minecraft User:
    MineBuilderFR
    Thanks :) Resolved

Share This Page

Advertisement