In a plugin I am developing I need to be able to restart the server from the plugin. How can I do this?
As far as I know you cannot do this within a plugin only you could edit the start.sh/cmd though I recommend taking a look at this https://github.com/iJoshuaHD/ASR
If you are using windows, there is a new start thing I've made. https://github.com/NotPocketMine/Auto-Restart/releases There are two restarter programs. One Color, and One Plain. The Color one is recommended. They both will use your file 'server.properties'. CATION: This is a brand new tool. This tool has not been accepted by the PMMP Forum staff, nor has been accepted on the old PocketMine forum. Use at your own will.
only thing would be to call PM shutdown and run something like system({somehow wait for PM to fully shutdown(without stopping pm from stopping)} $phpbin $pmmp.phar) the wait pm to exit and the command will run it back up that repo is suspicious with no code base
Suspicious... mmk... good point. If I look at it through someone else's views... The only reason I didn't add the code, is due to "People who don't know what they are doing at anything/noobs" breaking stuff. Should I add it?
The start.sh is not for editing. You can start the server with the -l option: Code: ./start.sh -l This will start the server with loops.
Well they cant break anything you can just reject their PR and if they choose to break it, it is their own fault
Asking how to restart server from plugin is like asking how to choose your identity in your next life. Unless you can get in contact with and affect the behaviour of the god or whatever deities in charge of spirits, you can't change it. And it is always very dangerous for a human to try to do so.
https://github.com/NotPocketMine/Auto-Restart/blob/master/src/colorstartloop.cmd does that suit you? Thats the whole code.
Technically the religion of Buddhism is based on the purpose of escaping the reincarnation cycle. So in that sense my plugin must be a master at meditation to escape the server cycle.
This describes what happens when I meditate: PHP: function meditate(){ if(thoughtOfSOmethingInteresting()) postRandomTweets(); else meditate();}function postRandomTweets(){ openBrowser(); meditate(); sendTweet(); // DEAD CODE}function thoughtOfSomethingInteresting(){ return rand(1, 10) > 9; // 90% probability returns false} Similarly, how does a plugin meditate? It waits until the next server starts and ends. Terrible idea. In addition: In case of stack overflow, in humans, the brain chooses to delete the oldest stack instead.