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

Broadcast Color Help

Comments in 'Plugin Development' started by PixelGuy75, Dec 11, 2014.

  1. PixelGuy75
    Offline

    PixelGuy75 Notable Member Plugin Developer

    Joined:
    Feb 9, 2014
    Posts:
    316
    Plugins:
    2
    Minecraft User:
    PixelGuy75
    I'm trying to broadcast the grey color in chat, but I can't seem to get it to work. Here's my code:
    PHP:
    $this->getServer()->broadcastMessage("§7".$sender->getPlayer()->getDisplayName() . " is now AFK");
  2. xFlare
    Offline

    xFlare Active Member Plugin Developer

    Joined:
    Sep 28, 2014
    Posts:
    199
    Plugins:
    1
    Minecraft User:
    xFlare
    You need to use block launcher to see colors.

    Even if its gray.
    EvolSoft likes this.
  3. PixelGuy75
    Offline

    PixelGuy75 Notable Member Plugin Developer

    Joined:
    Feb 9, 2014
    Posts:
    316
    Plugins:
    2
    Minecraft User:
    PixelGuy75
    Really? I thought you could see grey no matter what.
  4. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    Minecraft: PE just display grey color when a certain line of code starts with a slash (/)
    PixelGuy75, PEMapModder and EvolSoft like this.
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Or glitches lines after a \n
    (PocketMine will automatically split lines in a message by \n, so to send the \n to the player, you have to send a MessagePacket directly)
    iksaku likes this.
  6. PixelGuy75
    Offline

    PixelGuy75 Notable Member Plugin Developer

    Joined:
    Feb 9, 2014
    Posts:
    316
    Plugins:
    2
    Minecraft User:
    PixelGuy75
    Oh ok
  7. xFlare
    Offline

    xFlare Active Member Plugin Developer

    Joined:
    Sep 28, 2014
    Posts:
    199
    Plugins:
    1
    Minecraft User:
    xFlare
    Does anyone know how to stop PocketMine from breaking chat into lines?
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    If you use the sendMessage() function, it must break it. As I said, send a MessagePacket directly.
    PHP:
    // imports
    use pocketmine\network\protocol\MessagePacket;
    // code
    $message "one\ntwo";
    $pk = new MessagePacket;
    $pk->message $message;
    $pk->source "";
    $player /*something*/;
    $player->dataPacket($pk);
    iksaku and xFlare like this.
  9. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    But remember that it is a bad practice :p
    xFlare likes this.
  10. xFlare
    Offline

    xFlare Active Member Plugin Developer

    Joined:
    Sep 28, 2014
    Posts:
    199
    Plugins:
    1
    Minecraft User:
    xFlare
    What does a bad practice do to your server/plugin ? :O
  11. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    They can slow your server, break plugins or even crash xD but the results may vary depending on what are you doing :p
  12. xFlare
    Offline

    xFlare Active Member Plugin Developer

    Joined:
    Sep 28, 2014
    Posts:
    199
    Plugins:
    1
    Minecraft User:
    xFlare
    :eek:

    Thanks for that information. :D
    iksaku likes this.
  13. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    You're welcome :3
    xFlare likes this.
  14. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Sending raw packets does none of these things. Sending MessagePacket directly has no effect at all and in fact makes it a bit faster, although it may be incompatible with future MCPE versions while PocketMine will update the sendMessage() function to supported protocols.
    iksaku likes this.

Share This Page

Advertisement