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

[0.8.1 glitch] Two methods to make gray-color chat

Comments in 'Plugin Development' started by PEMapModder, May 16, 2014.

  1. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Two methods to make gray/grey color chat.

    1. "/"
    Since MCPE has a gray-colored chat in vanilla when players do commands beginning with "/", as a glitch, all message packets starting with "/" will have a gray color for commands.

    2. "\n"
    From https://github.com/PocketMine/PocketMine-MP/blob/master/src/Player.php#L714, we can see that the PocketMine developers tend to make packets with one line only per message. However, when you send a raw MessagePacket to a player, using
    PHP:
    $packet = new MessagePacket;
    $packet->source ""// no idea what this is for
    $packet->message "\nSomething gray";
    $player->dataPacket($packet)
    , we can make the line be in gray. However, this will leave a blank line above the gray line, and you will send another message packet to push up the gray line, or either it won't be shown or it will be overlapped by the next message packet.
    However, this is not gray when the player taps the chat button.

    I have been testing a plugin at https://github.com/PEMapModder/ChatLineBreaker but there is a strange bug when I use wordwrap.
    Here are the screenshots:
    Last edited: May 16, 2014
    LDX and iJoshuaHD like this.
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Here are the screenshots.

    Attached Files:

    iJoshuaHD likes this.
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Well, thanks, I fixed the problem. This is caused by having \n in a single message packet. However, @Falk please don't lock because I am going to change this thread into a thread about a discovery.
    Falk, Adrian18 and iJoshuaHD like this.

Share This Page

Advertisement