By continuing to use this site, you agree to the Terms of Service of this website, including usage of cookies.

OK, Don't show this again

A PocketMine-MP plugin that automatically restart your server once the chosen time is up
version 1.0.0
Approved
Direct Download How to install?
624 Downloads / 624 Total
3 Reviews
Plugin Description §

AutoRestarter

A PocketMine-MP plugin that automatically restart your server once the chosen time is up and who transfers your players to the IP and PORT chosen just before restarting !

Config

You can choose in the config the delay between each restart in minutes, the message if you want one to be broadcasted every 10 mins if the time to reboot is > 5 mins and to what IP and PORT are the players transferred just before the restart.

Something that you can do is transfer them to the server that is going to be restarted by leaving "default" to serverIp and serverPort in the config.

Events

This plugin is calling the following events:

  • PreRestartEvent: Called when the time is up and the server is going to restart, you can cancel this event and set a new delay in mins
use miste\autorestarter\event\PreRestartEvent;

/*
  To cancel server reboot and re schedule it 30 mins after
  NB: If you forget to setDelay() the event will be called the next min
*/

public function onPreRestartEvent(PreRestartEvent $ev){
        $ev->setDelay(30);
        $ev->setCancelled(true); 
}
  • MidRestartEvent: Called once all the players have just been transferred and before the plugins are disabled. It can be very useful to deal with configs to save your players data. You can get all the transferred players by doing getTransferredPlayers()
use miste\autorestarter\event\MidRestartEvent;

public function onMidRestartEvent(MidRestartEvent $ev){
        foreach ($ev->getTransferredPlayers() as $playerName){
          //your code here
        }
}

API

If you want to reboot the server at any time you can call the method AutoRestarter::restart(Server $server, ?string $serverIp = "default", ?int $serverPort = 19132);

/*
  This will restart the server and transfer all the players online to play.lbsg.net:19132.
*/
use miste\autorestarter\AutoRestarter;

AutoRestarter::restart($this->getServer(), "play.lbsg.net", 19132);

/*
  This will restart the server and transfer all the players online the IP and port provided in the config.
*/
use miste\autorestarter\AutoRestarter;

AutoRestarter::restart($this->getServer());

NB: This plugin doesn't work on Windows. You need pcntl extension to be enabled and compiled with PHP (by default on PM binaries).


AyzrixYTB
using v1.0.0
29 Aug 18
Gg :D des français sur poggit maintenant xD
MisteFr
29 Aug 18
Et oui ! (Hesite pas à check mon github)
llronaldoll
using v1.0.0
27 Aug 18
god job
MisteFr
28 Aug 18
Thanks !
A354-PH
using v1.0.0
26 Aug 18
Good!
MisteFr
27 Aug 18
Thanks !

Reply to review by :

Supported API versions
3.0.0
->
3.4.1
License §
Categories:
General
Admin Tools
Developer Tools
Permissions
Manage plugins

You can leave one review per plugin release, and delete or update your review at any time

Loading...