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

clearChunkCache error.

Comments in 'Plugin Development' started by Minifixio, Jul 9, 2015.

  1. Minifixio
    Offline

    Minifixio New Member Plugin Developer

    Joined:
    Mar 2, 2015
    Posts:
    41
    Plugins:
    2
    Minecraft User:
    Minifixio
    Hi guys,

    I have finished my 1vs1 plugin. In my plugin I'm using signs for display some stats (free arenas, players in the queue..), and the stats often refresh on the sign. But there is only one error : clearChunkCache.

    Indeed, when I lunch my server, it crashes at randoms times by clearChunkCache. And the error is : Fatal error: Call to a member function clearChunkCache() on null in phar:///Users/Minifixio/Desktop/Server3/PocketMine-MP.phar/src/pocketmine/tile/Sign.php...

    Do you know it ? Is it a PockteMine bug or a bug of my plugin ?

    Have you already seen it ? Have you got a solution ?

    Please tell me because it's very important for my plugin.

    Thanks,

    Minifixio :)
  2. Jaydenb1321
    Offline

    Jaydenb1321 New Member

    Joined:
    Aug 16, 2014
    Posts:
    45
    Minecraft User:
    ItzBulkDev
    Looks like you edited the pocketmine source. Does this error only occur when you launch the server with the plugin?
  3. Minifixio
    Offline

    Minifixio New Member Plugin Developer

    Joined:
    Mar 2, 2015
    Posts:
    41
    Plugins:
    2
    Minecraft User:
    Minifixio
    Hi,

    Sorry but I never edited the PocketMine source. And the error is only with this plugin.
  4. InusualZ
    Offline

    InusualZ Active Member Plugin Developer

    Joined:
    Aug 23, 2013
    Posts:
    220
    Plugins:
    1
    Minecraft User:
    Inusu4lZ
    Seems that sometime when you call that function the level object is null
  5. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,747
    Minecraft User:
    Legoboy0215
    Remember to $this->getServer()->loadLevel($worldname);!!!
    CrazedMiner likes this.
  6. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    Where did u get that from? The error is in his plugin when he calls the clearChunkCache() on null.
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Most likely you made something in PocketMine internals null (e.g. Passed a null parameter), then PocketMine assumed the parameter is correct without checking it not null. Can you enable debug in pocketmine.yml and show us the stack trace?
  8. Minifixio
    Offline

    Minifixio New Member Plugin Developer

    Joined:
    Mar 2, 2015
    Posts:
    41
    Plugins:
    2
    Minecraft User:
    Minifixio
    I never call clearChunkCache but I call sign->setText function that is a PM native function
  9. Minifixio
    Offline

    Minifixio New Member Plugin Developer

    Joined:
    Mar 2, 2015
    Posts:
    41
    Plugins:
    2
    Minecraft User:
    Minifixio
    Hi,

    I have activated the debug but I saw nothing...

    Here is the CrashDump file :

    Code:
    PocketMine-MP Crash Dump Tue Jul 7 21:42:08 UTC 2015
    
    Error: Call to a member function clearChunkCache() on null
    File: /src/pocketmine/tile/Sign
    Line: 62
    Type: E_ERROR
    
    Code:
    [53]     public function setText($line1 = "", $line2 = "", $line3 = "", $line4 = ""){
    [54]         $this->namedtag->Text1 = new String("Text1", $line1);
    [55]         $this->namedtag->Text2 = new String("Text2", $line2);
    [56]         $this->namedtag->Text3 = new String("Text3", $line3);
    [57]         $this->namedtag->Text4 = new String("Text4", $line4);
    [58]         $this->spawnToAll();
    [59]
    [60]         if($this->chunk){
    [61]             $this->chunk->setChanged();
    [62]             $this->level->clearChunkCache($this->chunk->getX(), $this->chunk->getZ());
    [63]         }
    [64]
    [65]         return \true;
    [66]     }
    [67]
    [68]     public function getText(){
    [69]         return [
    [70]             $this->namedtag["Text1"],
    [71]             $this->namedtag["Text2"],
    [72]             $this->namedtag["Text3"],
    
    Backtrace:
    #0 (): pocketmine\Server->crashDump()
    
    And here is the refreshSigns() function that makes my server crash :

    PHP:
        /**
         * Refresh all 1vs1 signs
         */
        
    public function refreshSigns(){

            foreach (
    $this->signTiles as $signTile){
                
    $signTile->setText(OneVsOne::SIGN_TITLETextFormat::DARK_RED TextFormat::BOLD "-En attente: " $this->getNumberOfPlayersInQueue(), TextFormat::DARK_RED TextFormat::BOLD "-Arenes: " $this->getNumberOfFreeArenas(), TextFormat::GOLD TextFormat::BOLD "-+===+-");
            }
        }
    Thanks for your help guys,

    Minifixio
  10. Minifixio
    Offline

    Minifixio New Member Plugin Developer

    Joined:
    Mar 2, 2015
    Posts:
    41
    Plugins:
    2
    Minecraft User:
    Minifixio
    Yes I'm using it :)
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    How did you define $this->signTiles? The level references have been broken.

Share This Page

Advertisement