PHP: <?phpdeclare(strict_types=1);namespace Storia\Commands;use pocketmine\command\CommandSender;use pocketmine\command\ConsoleCommandSender;use pocketmine\command\Command;use jojoe77777\FormAPI\SimpleForm;use jojoe77777\FormAPI\CustomForm;use pocketmine\event\Listener;use pocketmine\Player;use pocketmine\plugin\Plugin;use pocketmine\item\Item;use pocketmine\Server;use pocketmine\level\Level;use pocketmine\utils\TextFormat;use Storia\Loader;use Storia\EventListener;use pocketmine\command\PluginCommand;class ArenaCommand extends Command{ public $plugin; public function __construct(Loader $plugin) { parent::__construct("arenas", "Travel to a arena", "arenas"); $plugin->main = $plugin; } public function execute(CommandSender $sender, string $commandLabel, array $args) { $form = new SimpleForm(function (Player $sender, $data) { if ($data === null) { return false; } switch ($data) { case 0; $sender->sendMessage("Teleported to Gapple."); $sender->teleport($this->getServer()->getLevelByName("YourWorld")->getSafeSpawn()); $this->GappleKit($sender); break; I keep getting this error : [Server thread/CRITICAL]: Error: "Call to undefined method Storia\Commands\ArenaCommand::getServer()" (EXCEPTION) in "plugins/Storia/src/Storia/Commands/ArenaCommand" at line 44 if someone can help me that would be great
PHP: $sender->teleport($this->getServer()->getLevelByName("YourWorld")->getSafeSpawn()); Change to this because there arent any getServer function in the ArenaCommand PHP: $sender->teleport($this->plugin->getServer()->getLevelByName("YourWorld")->getSafeSpawn()); PHP: $plugin->main = $plugin; Change to this PHP: $this->main = $plugin;
So i decided to change it up a bit using your advice, I get this Error now, "Call to a member function getSafeSpawn() on null" Code: $level = "Gapple"; $sender->teleport($this->main->getServer()->getLevelByName($level)->getSafeSpawn());
Still get the same error '"Call to a member function getSafeSpawn() on null"" I even made sure the world was loaded, used multiworld to load it. I also did it with the default "world", still got the same error.
Impossible, are you sure you are loading the up to date plugin? (Are you restarting the server and not reloading it between tries?)