1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Using another plugins API

Discussion in 'Development' started by HittmanA, Jan 13, 2017.

  1. HittmanA

    HittmanA Zombie

    Messages:
    207
    GitHub:
    hittmana
    I am trying to get a player's chat format from PureChat. I looked through the code and I see a function getChatFormat(). How can I access that from my plugin and use it?
    PureChat: https://github.com/PurePlugins/PureChat/
     
  2. xBeastMode

    xBeastMode Shog Chips

    Messages:
    0
    What is "chat format"? What does it include? Do you want to get the message of the player or a part of the message?
     
  3. HittmanA

    HittmanA Zombie

    Messages:
    207
    GitHub:
    hittmana
    The getChatFormat() returns the nametag the player has after the PureChat styling has been added (to ensure that my plugin doesn't mess it up). Example nametag: [Example] HittmanA | Example chat nametag: [Example] HittmanA: Hi
     
  4. HittmanA

    HittmanA Zombie

    Messages:
    207
    GitHub:
    hittmana
    I simply need to know how to access a plugin's function and get what it returns.
     
  5. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    From the plugins main file, you can use
    PHP:
    $pp $this->getServer()->getPluginManager()->getPlugin("PurePerms");
    after that, you can just use whatever functions needed to do what you want within the plugin.
     
  6. HittmanA

    HittmanA Zombie

    Messages:
    207
    GitHub:
    hittmana
    And then I can just do
    PHP:
    $format $pp->getChatFormat(ARGS);
    ?
     
  7. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    @HittmanA that can be used as long as the plugin has that in its main file
     
    applqpak likes this.
  8. HittmanA

    HittmanA Zombie

    Messages:
    207
    GitHub:
    hittmana
    Ok Thanks
     
  9. Jack Noordhuis

    Jack Noordhuis Zombie Pigman Poggit Reviewer

    Messages:
    618
    GitHub:
    JackNoordhuis
    More accurately; if a function with that name exists in that class.
     
    jasonwynn10 likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.