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

Sign text and config

Comments in 'Plugin Development' started by xBeastMode, Jan 1, 2016.

  1. xBeastMode
    Offline

    xBeastMode Active Member

    Joined:
    Nov 27, 2015
    Posts:
    292
    When I check the sign text that's colored and try to see if it matches the config it doesn't work because the config's text doesn't have color. I tried TextFormat::RESET but that doesn't work either. Any other suggestions?
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Can you show how you did it?
  3. xBeastMode
    Offline

    xBeastMode Active Member

    Joined:
    Nov 27, 2015
    Posts:
    292
    PHP:
    use pocketmine\utils\TextFormat as color;//color

    const FORMAT_4 color::BLUE;//format 4

    $e->setLine(1HGManagement::FORMAT_4.$line[1]);//$line[1] is $event->getLines()[1] on SignChangeEvent

    if (isset($this->main->getConfig()->getAll()["hg_games"][color::RESET.$sign->getText()[1]])) {//PlayerInteractEvent
    //then nothing happens
    }
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    TextFormat::*** does not magically add color to the string. It just adds a §* to the string. If you want to clean a string's color, you have to use TextFormat::clean().
  5. xBeastMode
    Offline

    xBeastMode Active Member

    Joined:
    Nov 27, 2015
    Posts:
    292
    Thanks, it worked.

Share This Page

Advertisement