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

Solved Not getting online player

Discussion in 'Development' started by Mr174, Jan 30, 2020.

  1. Mr174

    Mr174 Baby Zombie

    Messages:
    187
    GitHub:
    mr174
    Ok in the end of my task i have this function run
    PHP:
    public function removePlayer(string $p) {
            
    $all $this->getXpmine()->getAll();

            if (
    $p instanceof Player){ //Here
                
    $p $this->getServer()->getPlayer($p);
                if (isset(
    $all[$p->getName()])) unset($all[$p->getName()]);
                
    $this->getXpmine()->setAll($all);
                
    $this->getXpmine()->save(); //To here
            
    }else{
                
    $queue $this->getQueued()->getAll();
                if (!isset(
    $queue[$p])){
                    
    $queue[$p] = 1;
                    
    $this->getQueued()->setAll($queue);
                    
    $this->getQueued()->save();

                    if (isset(
    $all[$p])) unset($all[$p]);
                    
    $this->getXpmine()->setAll($all);
                    
    $this->getXpmine()->save();
                }
            }
        }
    When the player is offline it runs correctly
    When the player is online it only runs the offline part the online isnt even getting called.
    So what did i mess up?
     
  2. Gianluxx

    Gianluxx Slime

    Messages:
    94
    GitHub:
    Gianluxx
    Code:
            $all = $this->getXpmine()->getAll();
            $p = $this->getServer()->getPlayer($p);
            if ($p instanceof Player){ //Here
                
                if (isset($all[$p->getName()])) unset($all[$p->getName()]);
     
    HimbeersaftLP and Mr174 like this.
  3. Mr174

    Mr174 Baby Zombie

    Messages:
    187
    GitHub:
    mr174
    I can't believe i had it in the wrong spot...
     
  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.