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

Need Help

Discussion in 'Development' started by QuiverlyRivalry, Oct 8, 2017.

  1. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    Hi my plugin gets this error can someone tell me how to fix it?
    PHP:
    07.10 02:54:34 [ServerServer thread/CRITICAL Could not pass event 'pocketmine\event\player\PlayerJoinEvent' to 'DIErespawnCR v0.1'Undefined propertyDIErespawnCR\Main::$level on DIErespawnCR\Main
    07.10 02
    :54:34 [ServerServer thread/CRITICAL ErrorException"Undefined property: DIErespawnCR\Main::$level(EXCEPTIONin "DIErespawnCR_v0.1.phar/src/DIErespawnCR/Main" at line 22
    07.10 02
    :54:34 [ServerServer thread/DEBUG #0 DIErespawnCR_v0.1.phar/src/DIErespawnCR/Main(22): pocketmine\error_handler(integer 8, string Undefined property: DIErespawnCR\Main::$level, string phar:///plugins/DIErespawnCR_v0.1.phar/src/DIErespawnCR/Main.php, integer 22, array Array())
    07.10 02:54:34 [ServerServer thread/DEBUG #1 src/pocketmine/plugin/MethodEventExecutor(38): DIErespawnCR\Main->onSpawn(pocketmine\event\player\PlayerJoinEvent object)
    07.10 02:54:34 [ServerServer thread/DEBUG #2 src/pocketmine/plugin/RegisteredListener(98): pocketmine\plugin\MethodEventExecutor->execute(DIErespawnCR\Main object, pocketmine\event\player\PlayerJoinEvent object)
    07.10 02:54:34 [ServerServer thread/DEBUG #3 src/pocketmine/plugin/PluginManager(721): pocketmine\plugin\RegisteredListener->callEvent(pocketmine\event\player\PlayerJoinEvent object)
    07.10 02:54:34 [ServerServer thread/DEBUG #4 src/pocketmine/Player(951): pocketmine\plugin\PluginManager->callEvent(pocketmine\event\player\PlayerJoinEvent object)
    07.10 02:54:34 [ServerServer thread/DEBUG #5 src/pocketmine/Player(891): pocketmine\Player->doFirstSpawn()
    07.10 02:54:34 [ServerServer thread/DEBUG #6 src/pocketmine/level/Level(2387): pocketmine\Player->sendChunk(integer 13, integer 19, pocketmine\network\mcpe\protocol\BatchPacket object)
    07.10 02:54:34 [ServerServer thread/DEBUG #7 src/pocketmine/level/Level(2428): pocketmine\level\Level->sendChunkFromCache(integer 13, integer 19)
    07.10 02:54:34 [ServerServer thread/DEBUG #8 src/pocketmine/level/format/io/ChunkRequestTask(91): pocketmine\level\Level->chunkRequestCallback(integer 13, integer 19, pocketmine\network\mcpe\protocol\BatchPacket object)
    07.10 02:54:34 [ServerServer thread/DEBUG #9 src/pocketmine/scheduler/AsyncPool(164): pocketmine\level\format\io\ChunkRequestTask->onCompletion(pocketmine\Server object)
    07.10 02:54:34 [ServerServer thread/DEBUG #10 src/pocketmine/scheduler/ServerScheduler(342): pocketmine\scheduler\AsyncPool->collectTasks()
    07.10 02:54:34 [ServerServer thread/DEBUG #11 src/pocketmine/Server(2512): pocketmine\scheduler\ServerScheduler->mainThreadHeartbeat(integer 1211)
    07.10 02:54:34 [ServerServer thread/DEBUG #12 src/pocketmine/Server(2257): pocketmine\Server->tick()
    07.10 02:54:34 [ServerServer thread/DEBUG #13 src/pocketmine/Server(2136): pocketmine\Server->tickProcessor()
    07.10 02:54:34 [ServerServer thread/DEBUG #14 src/pocketmine/Server(1718): pocketmine\Server->start()
    07.10 02:54:34 [ServerServer thread/DEBUG #15 src/pocketmine/PocketMine(556): pocketmine\Server->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, string phar:///custom-php7.2.phar/, string /, string /plugins/)
    My code is this:
    PHP:
    <?php
    namespace DIErespawnCR;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\event\player\PlayerJoinEvent;
    use 
    pocketmine\math\Vector3;
    class 
    Main extends PluginBase implements Listener{
     
        public function 
    onEnable(){
            
    $this->getServer()->getPluginManager()->registerEvents($this$this);
            
    $this->getServer()->getLogger()->info("DIErespawnCR Enabled!");
        }
     
        public function 
    onDisable(){
            
    $this->getServer()->getLogger()->info("DIErespawnCR Disabled!");
        }
     
        public function 
    onSpawn(PlayerJoinEvent $event){
            
    $player $event->getPlayer();
            
    $player->teleport($this->level->getSpawn());
        }
    }
     
  2. McpeBooster

    McpeBooster Baby Zombie

    Messages:
    190
    GitHub:
    mcpebooster
    what is in your opinion $this->level?
     
  3. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    693
    GitHub:
    winterbuild7074
    You need to define $this->level.
     
    Levi and iiFlamiinBlaze like this.
  4. armagadon159753

    armagadon159753 Zombie

    Messages:
    217
    GitHub:
    armagadon159753
    PHP:
    $player->teleport($player->getLevel()->getSafeSpawn());
    replace by that
     
    jasonwynn10 and iiFlamiinBlaze 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.