If this is implemented, think that it is not necessary for the plugin to determine whether or not the level is loaded one by one. That is, at the time the world's folder exists, it will be determined that the level class is acquired, or null is returned (internal loadLevel() error). Therefore, I think that the following implementation is good, but how is it? Summary: When getting a Level class with getLevel() etc, how about trying loadLevel() internally? PHP: // On Server Class// I omit some parameters so this is example.../** * @return Level[] */public function getLevels(): array { // No code changes, but returns are all getable Levels.}/** * @return Level|null */public function getDefaultLevel(): ?Level { // In first, trying to load Level // If you get an error with loadLevel(), throw an exception or close the server. $loaded = $this->loadLevel(); // Determine $loaded if ($loaded) { return $this->getLevel();// returns default level }else { return null; }}
I thought that but suspected the possibility of other abbreviations. Is this thread correct for posting in the RFC category?
If you mean if it's ok to post it there, then since the category is called "PocketMine-MP Contributing & RFCs" I think it would be okay to post it there, because the category's subject is broad enough. As for the thread's itself correctness, I don't think there are any strict rules for that.
I don't like this. The "Level->getChunk()" clusterfuck is enough implicit loading messes for me. It might seem convenient but it's a great way to cause unexpected behaviour. If you want to load something, whether it's a level, chunk, dimension or whatever, you should be explicit about it, especially in the case where whatever you're loading could be happening asynchronously.
Ok, I understood. Now, is there a way to check whether a level exists without loading unnecessary levels, or is there a corresponding function? I want to do that.