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

Using PureChat API

Comments in 'Plugin Development' started by AlexBrin, Apr 23, 2016.

  1. AlexBrin
    Offline

    AlexBrin New Member

    Joined:
    Apr 23, 2016
    Posts:
    9
    Sorry for the bad english :c

    I write a plugin that changes the format of the messages in the chat. How to do it with the help of PureChat API? Or you need to use PurePerms API? Help me, please :eek:
    I watched the source code, but did not understand how to use.
    Last edited: Apr 23, 2016
  2. minebuilder0110
    Offline

    minebuilder0110 Notable Member

    Joined:
    Dec 8, 2014
    Posts:
    485
    Minecraft User:
    Apparitional
    I am almost certain that PureChat gives you full control over chat message; what are you trying to do?
    KubixQ likes this.
  3. AlexBrin
    Offline

    AlexBrin New Member

    Joined:
    Apr 23, 2016
    Posts:
    9
    I want to change the message format to ours (I add to a new {argument}), and try to change it from your Plugin API
    I tried to make it through setOriginalChatFormat(), but it replaces the value of the config file, I noticed when I looked, what the function does :(
    I do not know what to do next :(

    Hopefully clearly explained
  4. MinePocket Servers
    Offline

    MinePocket Servers Active Member

    Joined:
    Mar 6, 2014
    Posts:
    69
    Minecraft User:
    MinePocket
    If you want to add new args into a chat whatever you need to edit purechat to first read off a config (so you can toggle it on and off) then get var from your other plugin. For an example,

    PHP:
    <?php

    namespace _64FF00\PureChat\factions;

    use 
    pocketmine\Player;
    use 
    pocketmine\Server;

    class 
    MPFac implements FactionsInterface
    {
        public function 
    getAPI()
        {
            
    //get yer plugin
            
    return Server::getInstance()->getPluginManager()->getPlugin("MPFac");
        }

        
    //get player faction - This is a MPFac function
        
    public function getPlayerFaction(Player $player)
        {
            return 
    $this->getAPI()->getSession($player)->getFaction();
        }

        
    //getplayerrank - also a MPFac function
        
    public function getPlayerRank(Player $player)
        {
            if(
    $this->getAPI()->getSession($player)->inFaction())
            {
                if(
    $this->getAPI()->getSession($player)->isOfficer()) {
                    return 
    '*';
                }
                elseif(
    $this->getAPI()->getSession($player)->isLeader())
                {
                    return 
    '**';
                }
                else
                {
                    return 
    '';
                }
            }

            return 
    '';
        }
    }

  5. AlexBrin
    Offline

    AlexBrin New Member

    Joined:
    Apr 23, 2016
    Posts:
    9
    Thank you very much, but I still do not understand how to change the message format... :(
    I looked PureChat API, and it seems there is no way to change the format. Or I'm wrong?
    Or need to change through setPrefix() and setSuffix()? But they are used to command...
  6. MinePocket Servers
    Offline

    MinePocket Servers Active Member

    Joined:
    Mar 6, 2014
    Posts:
    69
    Minecraft User:
    MinePocket
    Why on earth would purechat have premade functions to change the format? Thats what YOU do! Edit purechat to fit your needs.
  7. AlexBrin
    Offline

    AlexBrin New Member

    Joined:
    Apr 23, 2016
    Posts:
    9
    Oh ... I was afraid of...
    Well, I will do crutches. Thank you so much!

Share This Page

Advertisement