1313 */
1414package codedcosmos .enderbot .plugin ;
1515
16+ import codedcosmos .enderbot .core .ConfigManager ;
1617import codedcosmos .enderbot .discord .JDABot ;
1718import codedcosmos .enderbot .core .EnderBot ;
19+ import codedcosmos .enderbot .plugin .commands .BackupCommand ;
1820import codedcosmos .enderbot .utils .GoogleDrive ;
1921import codedcosmos .enderbot .utils .Log ;
2022import org .bukkit .plugin .java .JavaPlugin ;
@@ -26,22 +28,24 @@ public class MinecraftPlugin extends JavaPlugin {
2628 @ Override
2729 public void onEnable (){
2830 //Fired when the server enables the plugin
29- Log .print ("Enabling EnderBot" );
31+ Log .print ("Enabling EnderBot v" + EnderBot . getVersion () );
3032 EnderBot .load (true );
3133
3234 JDABot .initBot ();
3335 mainPlugin = this ;
36+
37+ this .getCommand ("enderbackup" ).setExecutor (new BackupCommand ());
3438
3539 getServer ().getPluginManager ().registerEvents (new MinecraftChatListener (), this );
36- archiveLoop ();
40+
41+ if (ConfigManager .world_backups_enabled ) archiveLoop ();
3742 }
3843
3944 public void archiveLoop () {
4045 JavaPlugin plugin = this ;
4146 getServer ().getScheduler ().scheduleSyncDelayedTask (this , new Runnable () {
4247 public void run () {
43- int time = GoogleDrive .archiveIfNeeded ();
44- Log .print ("Backup task completed in " + time + "ms" );
48+ GoogleDrive .archiveIfNeeded ();
4549 archiveLoop ();
4650 }
4751 }, 20L *60 *30 );
@@ -52,5 +56,6 @@ public void run() {
5256 public void onDisable (){
5357 //Fired when the server stops and disables all plugins
5458 Log .print ("Disabiling EnderBot" );
59+ JDABot .stop ();
5560 }
5661}
0 commit comments