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

Is it possible to change chat words

Comments in 'Plugin Development' started by DunxandMinecraft, Sep 27, 2015.

Thread Status:
Not open for further replies.
  1. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    In pocketmine is there any way to change multiple words:
    cheese
    ham
    sandwich

    into

    food?

    If possible how could I go around doing so?
    Thanks for all your help
  2. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    PlayerChatEvent::setMessage() and str_ireplace(). Use those.
  3. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    OK. Will do. Tomorrow.
  4. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    typo, it's str_replace.
  5. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    It's not a typo.
    str_ireplace() is not case sensitive like str_replace().
    jojoe77777 likes this.
  6. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Did not know :p, thanks.
    HotFireyDeath likes this.
  7. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Not a typo. There's str_replace() and there's the case-insensitive version: str_ireplace().
  8. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    I'm comfused. What do I use?
  9. DunxandMinecraft
    Offline

    DunxandMinecraft Active Member

    Joined:
    Oct 26, 2014
    Posts:
    158
    And could I have an example of how I could use it.
Thread Status:
Not open for further replies.

Share This Page

Advertisement