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

How do I add colors to what the plugin sends to the player?

Comments in 'Plugin Development' started by DGK, Apr 13, 2015.

  1. DGK
    Offline

    DGK New Member

    Joined:
    Apr 11, 2015
    Posts:
    1
    Minecraft User:
    DirtyGhettoKids
    Hey, so currently I'm editing a plugin that hasn't been updated since December of 2014 or 2013 to fit what I'd like it to be. (FactionsPro is the MCPE plugin, I'm trying to make it closer to a port of the PC plugin.) All the messages sent to the player are white. I'm using the latest development build, and I'm wondering how to do color codes? Do I use & or §, then the color code, or is it different than how you do it on PC servers?
  2. CookieSteve
    Offline

    CookieSteve Active Member

    Joined:
    Apr 22, 2014
    Posts:
    132
    Minecraft User:
    iStrqfeChris
    you use § and I believe you just put in next to the text and it will show
  3. xiaoq
    Offline

    xiaoq Active Member

    Joined:
    Dec 23, 2014
    Posts:
    232
    Minecraft User:
    xiaoq
  4. Angelo Vidrio
    Offline

    Angelo Vidrio Active Member Plugin Developer

    Joined:
    Jan 16, 2014
    Posts:
    123
    Plugins:
    5
    Minecraft User:
    LilCrispy45
    Or, if your actually trying to do this in your plugin files. I suggest using
    PHP:
    $sender->sendMessage(TextFormat::RED."This is a red message");
  5. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    Since I started developing PM plugins I've always used a special function to translate any character in MCPE color format. Initially this worked only on PM console (MCPE didn't support colors) but now it works on both MCPE and PM.
    However I think that if you use § on the message you want to send, it should be automatically translated in MCPE color
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Or just use the constants in the \pocketmine\utils\TextFormat class.

Share This Page

Advertisement