iTXTech / Genisys

Feature-rich server software for Minecraft: Pocket Edition & Windows 10 Edition Beta
https://itxtech.org/genisys/
GNU General Public License v3.0
435 stars 243 forks source link

Server crashed on loading world #2354

Closed smlrrlms closed 7 years ago

smlrrlms commented 7 years ago

Issue description

Server down after executing this part of code...

$i++;
$p=$this->getServer()->getPlayer($val["id"]);
//echo($i."\n");
$this->getServer()->loadLevel($this->config->get("pos1")["level"]);
$p->setLevel($this->getServer()->getLevelByName($this->config->get("pos1")["level"]));
eval("\$p->teleport(\$this->pos".$i.");");
unset($p);

Steps to reproduce the issue

Execute this code

OS and versions

Crashdump, backtrace, memory dumps, plugins list or other files

Genisys Crash Dump Wed Feb 8 20:55:18 EET 2017

Error: Call to a member function getEntities() on null
File: /src/pocketmine/Player
Line: 778
Type: notice

Code:
[769]           }
[770]       }
[771]   }
[772] 
[773]   private function unloadChunk($x, $z, Level $level = null){
[774]       $level = $level === null ? $this->level : $level;
[775]       $index = Level::chunkHash($x, $z);
[776]       if(isset($this->usedChunks[$index])){
[777]           $chunk = $level->getChunk($x, $z);
[778]           foreach($chunk->getEntities() as $entity){
[779]               if($entity !== $this){
[780]                   $entity->despawnFrom($this);
[781]               }
[782]           }
[783] 
[784]           if($level !== $this->level){
[785]               $pk = new FullChunkDataPacket();
[786]               $pk->chunkX = $x;
[787]               $pk->chunkZ = $z;
[788]               $pk->data = chr($chunk->getSubChunkSendCount());

Backtrace:
#0 /src/pocketmine/Player(1851): pocketmine\Player->orderChunks(boolean)
#1 /src/pocketmine/Server(2659): pocketmine\Player->checkNetwork(boolean)
#2 /src/pocketmine/Server(2378): pocketmine\Server->tick(boolean)
#3 /src/pocketmine/Server(2256): pocketmine\Server->tickProcessor(boolean)
#4 /src/pocketmine/Server(1860): pocketmine\Server->start(boolean)
#5 /src/pocketmine/PocketMine(478): pocketmine\Server->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, string phar:///home/smlr/PocketMine/PocketMine-MP.phar/, string /home/smlr/PocketMine/, string /home/smlr/PocketMine/plugins/)
#6 (1): require_once(string phar:///home/smlr/PocketMine/PocketMine-MP.phar/src/pocketmine/PocketMine.php)

Genisys version: 715b6a8f1939a534abbdc65b073d63ed29e0f8e1 [Protocol 100; API 3.0.0-ALPHA3]
uname -a: Linux lg570lnx 4.4.45-1-MANJARO #1 SMP PREEMPT Thu Jan 26 11:32:11 UTC 2017 x86_64
PHP version: 7.0.10
Zend version: 3.0.0
OS : Linux, linux

Server uptime: 43 секунд
Number of loaded worlds: 7
Players online: 1/30

Loaded plugins:
DevTools 1.11.1 by PocketMine Team for API(s) 2.0.0, 3.0.0-ALPHA1, 3.0.0-ALPHA2, 3.0.0-ALPHA3
ASR 2.0.2 by iJoshuaHD for API(s) 1.12.0, 2.0.0, 3.0.0-ALPHA3
TimeCommander 2.1 by LDX for API(s) 1.0.0, 2.0.0, 3.0.0-ALPHA3
FChestReset 1.0.0(English) by FENGberd for API(s) 1.0.0, 2.0.0, 3.0.0-ALPHA3
NoAdvertisingPE 1.0.1 by Vaivez66 for API(s) 1.12.0, 2.0.0, 3.0.0-ALPHA3
aDonateCases 1 by AlexBrin for API(s) 2.0.0, 3.0.0-ALPHA3
ManyWorlds 2.1.0 by aliuly for API(s) 2.0.0, 3.0.0-ALPHA3
PureEntitiesX 0.1.2_dev by milk0417, RevivalPMMP for API(s) 3.0.0-ALPHA3
TNTRunSMLR 1.0.0 by BukkitPlaysMC for API(s) 1.0.0, 2.0.0, 3.0.0-ALPHA3
PurePerms 1.3.7 by 64FF00 & ProjectInfinity for API(s) 1.13.0, 2.0.0, 3.0.0-ALPHA3
SimpleAuth 1.7.2 by PocketMine Team, shoghicp for API(s) 3.0.0-ALPHA3
Bedwars 2.2 by Bluplayz for API(s) 1.14.0, 2.0.0, 3.0.0-ALPHA3
MineReset 2.1 by Falk for API(s) 1.0.0, 2.0.0, 3.0.0-ALPHA3
SMLR 9999 by SMLR for API(s) 2.0.0, 3.0.0-ALPHA3
EconomyAPI 2.0.9 by onebone for API(s) 3.0.0-ALPHA3, 2.0.0, 2.1.0
FactionsPro 1.3.2 by Tethered_ for API(s) 1.12.0, 2.0.0, 3.0.0-ALPHA3
EconomyJob 2.0.4 by onebone for API(s) 3.0.0-ALPHA3, 2.0.0, 2.1.0
SClearLagg Beta_0.2 by Sergey_Dertan for API(s) 1.8.0, 2.0.0, 3.0.0-ALPHA3
ServerKits 1.2 by EvolSoft for API(s) 1.9.0, 2.0.0, 3.0.0-ALPHA3
BouncyBlocks 1.1 by Darunia18 for API(s) 1.9.0, 2.0.0, 3.0.0-ALPHA3
SAC 3.1.1 by DarkWav for API(s) 2.0.0, 1.0.0, 3.0.0-ALPHA3
PeacefulSpawn 2.5 by LDX for API(s) 1.0.0, 2.0.0, 3.0.0-ALPHA3
AntiSpam 1.3 by xBeastMode for API(s) 2.0.0, 3.0.0-ALPHA3
spleef 1.0.1 by  for API(s) 1.0.0, 1.1.0, 2.0.0, 3.0.0-ALPHA3
1vs1 0.0.5 by  for API(s) 1.0.0, 1.1.0, 2.0.0, 3.0.0-ALPHA3
FSurvivalGame 1.0.3(Translated by SMLR) by FENGberd for API(s) 1.0.0, 2.0.0, 3.0.0-ALPHA3
DropParty 1.0.3 by HotshotHD for API(s) 1.12.0, 1.13.0, 2.0.0, 3.0.0-ALPHA3
SimpleAuthHelper 2.0.4 by aliuly for API(s) 1.12.0, 2.0.0, 3.0.0-ALPHA3
TapToDo 2.2.1 by Falk for API(s) 1.0.0, 2.0.0, 3.0.0-ALPHA3
SW_svile 0.6dev by svile for API(s) 2.0.0, 3.0.0-ALPHA3
ColorMatch 1.1.2 by CreeperFace for API(s) 1.12.0, 2.0.0, 3.0.0-ALPHA3
EconomySell 2.0.7 by onebone for API(s) 1.12.0, 2.0.0, 3.0.0-ALPHA3
EconomyLand 2.0.9 by onebone for API(s) 3.0.0-ALPHA3, 2.0.0, 2.1.0
EconomyShop 2.0.7 by onebone for API(s) 1.12.0, 2.0.0, 3.0.0-ALPHA3
Jail 2.1.2 by hoyinm14mc for API(s) 1.13.0, 1.13.1, 2.0.0, 3.0.0-ALPHA3
PureChat 1.4.0 by 64FF00 for API(s) 1.13.0, 2.0.0, 3.0.0-ALPHA3
GrabBag 2.5.0 by aliuly for API(s) 1.10.0, 1.11.0, 1.12.0, 2.0.0, 3.0.0-ALPHA3
Muqsit commented 7 years ago

Closing. You haven't provided what $val["id"] is. I am guessing it is an integer (Player::getId()). It is supposed be the player's name (string).

smlrrlms commented 7 years ago
...
$this->players=array();
...
$this->players[$event->getPlayer()->getName()]=array("id"=>$event->getPlayer()->getName());
...
if($this->gameStatus==0)
        {
            $i=0;
            foreach($this->players as $key=>$val)
            {
                $i++;
                $p=$this->getServer()->getPlayer($val["id"]);
                //echo($i."\n");
                $this->getServer()->loadLevel($this->config->get("pos1")["level"]);
                $p->setLevel($this->getServer()->getLevelByName($this->config->get("pos1")["level"]));
                eval("\$p->teleport(\$this->pos".$i.");");
                unset($p);
            }
        }
smlrrlms commented 7 years ago

Main.php of this plugin - http://pastebin.com/VCr4VqCA PluginCallbackTask.php - http://pastebin.com/zGc0XP8w

dktapps commented 7 years ago

You're seriously using eval()? wtf :facepalm:

smlrrlms commented 7 years ago

Its very old plugin and not my. On previous API its work and it suited me ...

Muqsit commented 7 years ago

In that case, contact the author requesting him to update the plugin.

smlrrlms commented 7 years ago

The author has long ceased its development. better tell me what error occurs or where to look.

smlrrlms commented 7 years ago

This occurs when the player clicks on a plate.

Muqsit commented 7 years ago

This isn't a support forum. Better not use the plugin if the author has abandoned it.