My problem is that in my 1vs1 plugin I use new Position (var1, var1, var3, level); I keep it in a variable and I send it to what would be the arena ... the problem comes when I want to do a map reset since one of the minigames will be BuildUhc and I need the map to be reset when they put blocks because resetting the world obviously in the new position will erase the world as the world is disabled How could you solve this? What alternatives do I have? What do you advise me?
You could create a function that returns a Position instance than saving the position instance in a variable. PHP: public function getPosition() : Position{ return new Position(var1, var2, var3, Server::getInstance()->getLevelByName(levelName));} Or you could rebuild the level in the position instance if you don't want to create a Position instance everytime and want to keep it all short and simple. PHP: /** @var Position */public $myPosition;//new Position(var1, var2, var3, level)/** @var string */public $myLevelName;//level->getName()public function getPosition() : Position{ $pos = $this->myPosition; if($pos->level->isClosed()){ $pos->setLevel(Server::getInstance()->getLevelByName($this->levelName)); } return $pos;} But the best solution would be to not unload and reload the Level every so often. Loading a level is a heavy process.