Hi, yesterday I downloaded the new pocketmine 1.3.12 with the new API 12 and there's a problem with the plugin: PHP: $this->api->console->run("restart"); this code, in API 11, restart the server, but doesn't work with te new api. Is this code changed? The console doesn't send error message. Thanks
ok here is the problem the $this->api->console->run part is ok but if your trying to stop the server like /stop then it has to be $this->api->console->run("stop");
The "code" from @jerlegom is rigth. You cant restart the Server with a command. You have to edit the Start.bat/sh Did you host your Servers on Linux or Windows?
$this->api->console->run just runs a command from console but the command must exist. you can find some great examples in the advanced gamemode plugins code
But he whants to restart his Server, its exists a server restart with the rigth start.bat/sh! You have then only run in the console "stop", the start.sh/bat is coded to restart the Server!
The only way to do that (That exist) is to make a server loop, just edit your "start.sh" file, delete everything and paste this: Code: #!/bin/bash DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd "$DIR" if [ -f ./php5/bin/php ]; then exec ./bin/php5/bin/php -d enable_dl=On PocketMine-MP.php [email protected] fi while : do rm console.log sleep 5 ./bin/php5/bin/php -d enable_dl=On PocketMine-MP.php [email protected] done read -p "Press [Enter] to continue..." exit This will automatically restart your server when you do "/stop" or your server crashes