So my 7 years old daughter got crazy about minecraft and being a great dad I wanted to setup a server for her and friends. That went well until my perfectionism kicked in So infinite worlds plugin was buggy and crashed (and world in pocket edition is just so tiny) so decided to make my own plugin, but I'm not really getting the api and haven't found working examples so maybe you could help. Problems begin with the code that tries to send player to the new map. Since code that should get the level (according to infinite worlds plugin) crashes with "Trying to get property of non-object" I've no idea how to get hold of the level object (and whether I should load the level first if it's not loaded). So my first question is how to make following work: $level = $this->server->api->level->get($newworld); //Why I don't have $server defined? $playerobject->teleport(new Position(0, 0, 50, $level)); My second question is how to find ground level in the new map since I don't want to go to spawn point but just cross the map border to the other side? Here's the full code: PHP: <?php/*//IMPORTANT testing this code requires nine maps named (00,01,02,10,11,12,20,21,22)__PocketMine Plugin__name=LargeWorlddescription=Simple infinity world by loading a new world.version=0author=Jayclass=LargeWorldapiversion=12,13*/class LargeWorld implements Plugin { private $api; public $coord = array( "gridsize" => 3, "maxx" => 255, "maxz" => 255, "minx" => 0, "minz" => 0 ); //public $maxworld = 10; private $limit; public function __construct(ServerAPI $api, $server = false) { $this->api = $api; $this->limit=$this->coord["gridsize"]-1; } public function init() { $this->api->addHandler("player.move", array($this, "move")); } public function __destruct() {} private function GetWorld($world,$dir) { $loc=preg_split('//', $world, -1, PREG_SPLIT_NO_EMPTY); switch($dir) { case 'right': $x=$loc[0]+1; $y=$loc[1]; break; case 'left': $x=$loc[0]-1; $y=$loc[1]; break; default: return false; break; } if($x<0){ $x=$this->limit;} if($y<0){ $y=$this->limit;} if($x>$this->limit){ $x=0;} if($y>$this->limit){ $y=0;} return $x.$y; } public function move($data){ $plobj = $this->api->player->get($data->name); $plobj->sendChat("[LargeWorld] X: ".intval($data->x)." Y:".intval($data->z)); $newworld=false; //moving right if(intval($data->x) == $this->coord["maxx"]) { $world = $plobj->level->getName(); $newworld = $this->GetWorld($world,'right'); $plobj->sendChat("[LargeWorld] New World is ".$newworld); } //moving left if(intval($data->x) == $this->coord["minx"]) { $world = $plobj->level->getName(); $newworld = $this->GetWorld($world,'left'); $plobj->sendChat("[LargeWorld] New World is ".$newworld); } if($newworld && $this->api->level->levelExists($newworld)){ //$plobj->teleport(new Position(0, 0, 50, $newworld)); $lv = $this->server->api->level->get($newworld); //$plobj->teleport($lv->getSafeSpawn()); $plobj->sendChat("[LargeWorld] You are in a new world: ".$newworld); } return true; }} Thank you!
I would advise you to wait for 0.9.0 as 1. It has infinite worlds, so you would have to stitch these worlds together somehow 2. This plugin would be outdated and would not work with the 1.0 API
Thank you. So is this 0.9.0 like so many other releases (not minecraft related) that are about to be released for years and never come or is there a set date? I guess I'm not that serious anymore on developing this but it's so close to be 'ready' and those bugs are just irritating. So I got it to work for a while almost perfectly and but then I added level creation code and after that I've been spawning inside walls I have no idea what's wrong or if I have understood what getSafeSpawn is supposed to do. Here's the updated code: PHP: <?php/*NOTE: default map name must be 11 or other legit name__PocketMine Plugin__name=LargeWorlddescription=Simple infinity world by loading a new world.version=24.05.14author=Jayclass=LargeWorldapiversion=12,13*/class LargeWorld implements Plugin { private $api; private $server; public $coord = array( "gridsize" => 3, "maxx" => 255, "maxz" => 255, "minx" => 0, "minz" => 0 ); //public $maxworld = 10; private $limit; private $allowcreation; private $debug; public function __construct(ServerAPI $api, $server = false) { $this->api = $api; $this->server =ServerAPI::request(); $this->limit=$this->coord["gridsize"]-1; $this->allowcreation=true; $this->debug=true; } public function init() { $this->api->addHandler("player.move", array($this, "move")); } public function __destruct() {} private function GetWorld($world,$dir) { $loc=preg_split('//', $world, -1, PREG_SPLIT_NO_EMPTY); switch($dir) { //y is Z case 'right': $x=$loc[0]+1; $y=$loc[1]; break; case 'left': $x=$loc[0]-1; $y=$loc[1]; break; case 'up': $x=$loc[0]; $y=$loc[1]+1; break; case 'down': $x=$loc[0]; $y=$loc[1]-1; break; default: return false; break; } if($x<0){ $x=$this->limit;} if($y<0){ $y=$this->limit;} if($x>$this->limit){ $x=0;} if($y>$this->limit){ $y=0;} return $x.$y; } private function toggle($number) { if($number==$this->coord["minx"]){return $this->coord["maxx"]-1;} if($number==$this->coord["maxx"]){return $this->coord["minx"]+1;} return $number; } private function getNextPosition($data) { //<0,x,45> turns <254,x,45> for the new map. return new Vector3($this->toggle($data->x),150,$this->toggle($data->z)); } public function move($data){ $plobj = $this->api->player->get($data->name); $world = $plobj->level->getName(); if($this->debug){$plobj->sendChat("[LargeWorld] ".$world." X: ".intval($data->x)." Z:".intval($data->z)." Y: ".intval($data->y));} $newworld=false; //moving right if(intval($data->x) == $this->coord["maxx"]) { $world = $plobj->level->getName(); $newworld = $this->GetWorld($world,'right'); } //moving left if(intval($data->x) == $this->coord["minx"]) { $world = $plobj->level->getName(); $newworld = $this->GetWorld($world,'left'); } //moving up if(intval($data->z) == $this->coord["maxz"]) { $world = $plobj->level->getName(); $newworld = $this->GetWorld($world,'up'); } //moving down if(intval($data->z) == $this->coord["minz"]) { $world = $plobj->level->getName(); $newworld = $this->GetWorld($world,'down'); } if($newworld){ if($this->api->level->levelExists($newworld)) { $plobj->sendChat("[LargeWorld] Level exists"); $levelLoaded=$this->api->level->loadLevel($newworld); if($levelLoaded) { $plobj->sendChat("[LargeWorld] Level is loaded"); $lv = $this->server->api->level->get($newworld); $plobj->teleport($lv->getSafeSpawn($this->getNextPosition($data))); $plobj->sendChat("[LargeWorld] New World is ".$newworld); } } else //let's create a level { if($this->allowcreation) { $plobj->sendChat("[LargeWorld] Generating new world."); $this->api->level->generateLevel($newworld); $lv = $this->server->api->level->get($newworld); $plobj->teleport($lv->getSafeSpawn()); } } } return true; }}
There is no set release date unfortunately, but beta testing for 0.9.0 should start next week if everything goes as planned for the developers. Once beta testing has started, it will be on for 2-4 weeks. Then once all bugs are fixed while and the app has been submitted to the Play Store it should take a week or two for Android, and at least 3 weeks for Apple. So basically, it will be another long month...
As the above posters have stated, 0.9.0 is less than a month away. The thing is, though, PocketMine's 1.4 update is advancing very quickly, and may be released before that. I'm guessing that the 1.4 update will be moved to the master branch on it's GitHub in the next week or so, and after that, it shouldn't be long before it is the official release.
Then I guess I should quit being lazy and work on updating my plugins to the new API..... *sigh* I was enjoying being able to be lazy for once...
I have a few plugins I gotta update for a friend (and I also want to update Claymores). I wish I was being lazy, but I just don't have time I hate it...
I agree with this except with Android I doesnt not need to get accepted, it becomes live right away, and with Apple I find it takes them 1 week to accept updates to my apps so I assume it will be the same with MCPE(P.S in case you didn't pick it up, I create apps for iOS and Android XD ). So what I guess they will do is wait till the iOS update gets accepted then once it does they will release the android update at the same time
This is true but if you think about it, it stops developers from putting malicious code in there apps, and the reason why it takes so long is because Apple have hundreds of thousands of app/updates to review so the update time is justified.