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

error getServer

Discussion in 'Facepalm' started by kaliiks, Jan 14, 2017.

  1. kaliiks

    kaliiks Zombie

    Messages:
    250
    PHP:
    $pos2 = new Position(126630$this->plugin->getServer()->getLevelByName("Lobby2"));
    $p->teleport($pos200);
    Code:
    [19:49:01] [Server thread/CRITICAL]: "Could not pass event 'pocketmine\event\player\PlayerJoinEvent' to 'Core v1': Call to a member function getServer() on null on Core\EventListener
    [19:49:01] [Server thread/CRITICAL]: Error: "Call to a member function getServer() on null" (EXCEPTION) in "myzip:///Core.zip#Core/src/Core/EventListener" at line 60
    
     
  2. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    You might want to show your whole event listener for this. Looking at this, it looks fine. There's probably something wrong in the constructor.
     
  3. kaliiks

    kaliiks Zombie

    Messages:
    250
    Oh I forgot to use constructor
    Now i used this and console said
    Code:
    [20:07:16] [Server thread/CRITICAL]: TypeError: "Argument 1 passed to Core\EventListener::__construct() must be an instance of Core\Core, none given, called in myzip:///root/server/plugins/Core.zip#Core/src/Core/Core.php on line 22" (EXCEPTION) in "myzip:///Core.zip#Core/src/Core/EventListener" at line 32
    
    PHP:
    public function __construct(Core $plugin) {
        
    $this->plugin $plugin;
        
    parent::__construct($plugin);
    }
     
  4. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    You didn't pass your core object
    example (if you are constructing from your Core class) new ListenerClassName($this);
    where $this is an instance of the Core class
     
  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.