BackUpPlugin icon

BackUpPlugin -----

Local and FTP world backup.



Backup process runs asynchronously to prevent freezing.
1. Added an Asynchronous Method for Backups
  • A new method, backupWorldsAsync, was introduced to execute the backup process in a separate thread using Bukkit.getScheduler().runTaskAsynchronously.
  • This method internally calls the existing backupWorlds method, but it does so asynchronously.
New Method:
Code (YAML):
private void backupWorldsAsync (String saveType ) {
    Bukkit.getScheduler ( ).runTaskAsynchronously (this, ( ) -> {
        try {
            backupWorlds (saveType );
            getLogger ( ).info ( "Backup completed successfully!" );
        } catch (Exception e ) {
            getLogger().severe("Backup failed
: " + e.getMessage());
        }
    });
}

2. Modified the /backupnow Command

  • The /backupnow command now uses the backupWorldsAsync method instead of directly calling backupWorlds.
  • Users receive a message indicating that the backup is starting asynchronously, and the server can continue running without delays caused by the backup process.
Updated /backupnow Block:

Code (YAML):
if (command.getName ( ).equalsIgnoreCase ( "backupnow" ) ) {
    if (!sender.hasPermission ( "backupplugin.backupnow" ) ) {
        sender.sendMessage ( "You don't have permission to use this command." );
        return true;
    }
    sender.sendMessage ( "Starting manual backup asynchronously..." );
    backupWorldsAsync ( "ManualSave" );
    return true;
}
 
3. Preserved the Original Functionality
  • The original backupWorlds method remains unchanged, as it is called internally by the new asynchronous method
  • Applied and tested on live server: majnuj.com
----------, Jan 6, 2025
Resource Information
Author:
----------
Total Downloads: 139
First Release: Jan 4, 2025
Last Update: Jan 6, 2025
Category: ---------------
All-Time Rating:
0 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings