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

how to prevent plugin? setComponents() on null

Comments in 'Plugin Development' started by Creeperface, Jul 28, 2015.

  1. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    on join, onQuit/Kick, onCommand, onInteract, in Task
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Can you show me the code in task?
  3. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    sure
    PHP:
    public function onRun($currentTick){
            if(
    $this->plugin->starting === true){
                
    $this->starting();
            }
            if(
    $this->plugin->game === 1){
                
    $this->game();
            }
            if(
    $this->sign === 2){
                
    $this->updateMainSign();
                if(
    $this->plugin->game === 0){
                    
    $this->updateTeamSigns();
                    
    $this->plugin->checkLobby();
                }
                
    $this->sign 0;
            }
            
    $this->sign++;
        }

    public function 
    starting(){
            if(
    $this->startTime === 5){
                    
    $this->plugin->selectMap();
                }
                if(
    $this->startTime === 0){
                    
    $this->plugin->startGame();
                    
    $this->startTime 0;
                    
    $this->plugin->starting false;
                    return;
                }
                foreach(
    $this->plugin->getArenaPlayers() as $p){
                    
    $p->sendPopup(TextFormat::GREEN."Hra startuje za $this->startTime sekund");
                }
                
    $this->startTime--;
        }
    startGame method
    PHP:
    public function startGame($force false){
            if(
    count($this->lobbyp) < && $force === false){
                
    $this->messageAllPlayers($this->plugin->getPrefix()."Je potreba 8 hracu");
                
    $this->starting false;
                
    $this->task->startTime 60;
                return;
            }
                
    $this->game 1;
                foreach(
    $this->lobbyp as $p){
                    if(
    $p->isOnline()){
                        unset(
    $this->lobbyp[strtolower($p->getName())]);
                        for(
    $i 1$i 4$i++){
                            if(!
    $this->isTeamFull($i)){
                                
    $this->addToTeam($p$i);
                                break;
                            }
                        }
                        
    $p->teleport($this->plugin->mainLobby);
                        if(
    $this->mtcore->mysqlmgr->getRank($p->getName()) != "hrac"){
                            
    $p->getInventory()->addItem(Item::get(336016));
                            
    $p->getInventory()->addItem(Item::get(26504));
                            
    $p->getInventory()->addItem(Item::get(26601));
                        }
                        
    //$p->setDisplayName($this->mtcore->getDisplayRank($p)." ".$p->getName());
                        //$p->setNameTag($this->mtcore->getDisplayRank($p)."  ".$p->getName());
                    
    }
                }
                foreach(
    $this->getPlayersInTeam() as $p){
                    if(
    $p->isOnline()){
                    unset(
    $this->lobbyp[strtolower($p->getName())]);
                    
    $this->ingamep[strtolower($p->getName())] = $p;
                    
    $team $this->getPlayerTeam($p);
                    
    $p->setHealth(20);
                    if(!
    $this->plugin->getServer()->isLevelLoaded($this->map)){
                        
    $this->plugin->getServer()->loadLevel($this->map);
                    }
                    if(isset(
    $this->data[$team."spawn"])){
                        
    $p->teleport(new Position($this->data[$team."spawn"]->x$this->data[$team."spawn"]->y$this->data[$team."spawn"]->z$this->plugin->getServer()->getLevelByName($this->map)));
                        
    $p->setSpawn(new Vector3($this->data[$team."spawn"]->x$this->data[$team."spawn"]->y$this->data[$team."spawn"]->z));
                    }
                    }
                }
                
    $this->level->setTime(5000);
                
    $this->level->stopTime;
                
    $this->messageAllPlayers($this->plugin->getPrefix().TextFormat::AQUA."Game started!");
        }
    every where where i have $player->teleport i made $player->isOnline()
    bedwars is not good because i save player in more arrays :/ can it be why server crashes?
    PEMapModder likes this.
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    If the player is not null, its temporalVector should either be initialized or notnull.

    Which join event do you use?
  5. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    PlayerJoinEvent
  6. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
  7. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    Should i use another join event?
  8. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    so please.. what this error means or what is temporalVector ?
  9. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    OMGOMGOMGOMGOMGOMGOMGOMGOMGOMGOMGOMGOMGOMG i found full crash :D can you help me?
    Code:
    Fatal error: Call to a member function setComponents() on null in phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/entity/Entity__32bit.php on line 1427
    
    Call Stack:
        0.0344     408848   1. {main}() C:\Users\Honza\Documents\PocketMine-MP\PocketMine-MP.phar:0
        0.0388     403752   2. require('phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/PocketMine.php') C:\Users\Honza\Documents\PocketMine-MP\PocketMine-MP.phar:1
        0.5216     542576   3. pocketmine\Server->__construct() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/PocketMine.php:464
        8.9625   15056704   4. pocketmine\Server->start() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/Server__32bit.php:1784
        8.9760   15072632   5. pocketmine\Server->tickProcessor() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/Server__32bit.php:2184
        8.9761   15073104   6. pocketmine\Server->tick() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/Server__32bit.php:2306
        8.9762   15073392   7. pocketmine\network\Network->processInterfaces() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/Server__32bit.php:2491
        8.9762   15073480   8. pocketmine\network\RakLibInterface->process() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/network/Network.php:146
        8.9849   15102304   9. raklib\server\ServerHandler->handlePacket() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/network/RakLibInterface.php:81
        8.9857   15111056  10. pocketmine\network\RakLibInterface->handleEncapsulated() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/raklib/server/ServerHandler__32bit.php:90
        8.9858   15118920  11. pocketmine\Player->handleDataPacket() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/network/RakLibInterface.php:140
        8.9858   15119088  12. pocketmine\network\Network->processBatch() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/Player__32bit.php:1600
        8.9862   15136144  13. pocketmine\Player->handleDataPacket() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/network/Network.php:228
        8.9892   15144808  14. pocketmine\plugin\PluginManager->callEvent() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/Player__32bit.php:1684
        8.9893   15145096  15. pocketmine\plugin\RegisteredListener->callEvent() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/plugin/PluginManager.php:673
        8.9893   15145120  16. pocketmine\plugin\MethodEventExecutor->execute() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/plugin/RegisteredListener.php:96
        8.9893   15145208  17. reasonWL\Main->onJoin() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/plugin/MethodEventExecutor.php:36
        9.0213   15145688  18. pocketmine\Player->kick() C:\Users\Honza\Documents\PocketMine-MP\plugins\ReasonWL\src\reasonWL\Main.php:94
        9.0237   15151296  19. pocketmine\plugin\PluginManager->callEvent() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/Player__32bit.php:2803
        9.0240   15151448  20. pocketmine\plugin\RegisteredListener->callEvent() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/plugin/PluginManager.php:673
        9.0240   15151448  21. pocketmine\plugin\MethodEventExecutor->execute() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/plugin/RegisteredListener.php:96
        9.0240   15151488  22. Annihilation\Annihilation->onKick() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/plugin/MethodEventExecutor.php:36
        9.0241   15151632  23. pocketmine\Player->teleportImmediate() C:\Users\Honza\Documents\PocketMine-MP\plugins\Annihilation\src\Annihilation\Annihilation.php:183
        9.0241   15151936  24. pocketmine\entity\Entity->teleport() phar://C:/Users/Honza/Documents/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/Player__32bit.php:3305
    
    PEMapModder likes this.
  10. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    what is wrong on teleportImmediate?
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Don't teleport after kicking.
  12. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
  13. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    when player is kicked it call quitEvent too?
  14. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Yes.

Share This Page

Advertisement