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

Not sending message

Discussion in 'Development' started by di2134876, Oct 31, 2017.

  1. di2134876

    di2134876 Spider Jockey

    Messages:
    29
    GitHub:
    dk1234987
    Hello, want to know why it doesn't send my message.
    Code:
    PHP:
        public function sendTest(Player $sender$player null) {
            
    $playerOb $sender->getServer()->getPlayer($player);
            if (
    $playerOb instanceof Player) {
                
    $sender->sendArgsMessage(TextFormat::GRAY "---- {0}'s Coin ----"$playerObject->getName());
                foreach(
    $playerOb->getAllTest() as $test) {
    // This one
                    
    $sender->sendMessage(TextFormat::GRAY $test->getKit()->getName() . ": " TextFormat::GOLD $test->getTest());
                }
     
  2. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    This is really a PHP question, not pocketmine... When you use '$anyobject->function()', the function must be accessible in that object, but you have several that are not. Use an IDE, include pocketmine source code, and you'll get help for this kind of problem as you type.
     
    jasonwynn10 likes this.
  3. di2134876

    di2134876 Spider Jockey

    Messages:
    29
    GitHub:
    dk1234987
    Hello, i rename all the functions and objects so that my plugin will not be leaked, $test->getTest(); is just a renamed version of
    $elo->getElo();
    getElo() is defined in another file which is accessible by using: use di21\Elo\basefiles\elo
     
  4. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    We can't guess what the rest of your code looks like, but I doubt that your Player object has a function called getAllTest().

    Unless you post the actual code we can't help much, so either you keep it to yourself and fix it yourself, or you share the code and the community helps.
     
    Last edited: Oct 31, 2017
    jasonwynn10 and InspectorGadget like this.
  5. di2134876

    di2134876 Spider Jockey

    Messages:
    29
    GitHub:
    dk1234987
     
  6. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    A player which has been returned by the Server Object will never be instanceof your ArenaPlayer.
     
  7. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    That's yet another incomplete piece of code. How are we supposed to guess what an ArenaPlayer is?
     
    jasonwynn10 likes this.
  8. Jack Noordhuis

    Jack Noordhuis Zombie Pigman Poggit Reviewer

    Messages:
    618
    GitHub:
    JackNoordhuis
    Unless they used PlayerCreationEvent ;)
     
    SOFe likes this.
  9. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Or directly created by the plugin, like Specter ;)
     
    jasonwynn10 and Jack Noordhuis like 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.