BackUpPlugin icon

BackUpPlugin -----

Local and FTP world backup.




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

  • Details of the Change:
  • Added isFTPConnectionValid Method:
    • Validates FTP connection before starting the backup process.
    • If the FTP connection is unavailable, the backups are stored locally.
  • Updated backupWorlds Method:
    • Checks FTP connection availability before initiating the backup.
    • When FTP is functional:
      • Uploads backups to the FTP server.
      • Deletes local backups after successful uploads.
    • When FTP is not functional:
      • Retains backups locally.
    • Added detailed logging to track the process.
  • Enhanced Command Handling in onCommand:
    • Logs each received command for easier debugging.
    • Provides user feedback for insufficient permissions.
    • Implemented commands:
      • backupnow: Triggers manual backups.
      • backupreload: Reloads plugin configuration.
      • backupinfo: Displays plugin information.
      • backupauto: Executes automatic backups.
  • Preserving Old Backups Using manageLocalBackups:
    • Ensures the maximum number of backups is maintained.
    • Automatically deletes the oldest backups if the limit is exceeded.
  • Improved Logging:
    • Added detailed logs for backup and FTP upload operations.
    • Logs successes and errors during the process.
  • Added scheduleDailyBackup Method:
  • Automatically performs backups based on a configured time.
  • Ensures backups are not repeated within short intervals.
  • Applied and tested on live server: majnuj.com
----------, Jan 5, 2025

Details of the Change:

1. Added support for a configurable list of ignored directories:
A new key, ignored-directories, was introduced in config.yml.
This key contains a list of directory names that should be skipped during the backup process.

2. Updated the zipFolder method:
Before processing each directory or file, the method checks if the directory name matches any entry in the ignored-directories list.

Result:
Administrators can easily add or remove directories to be ignored via the configuration file.
The default ignored directories are:
advancements
playerdata
stats

Applied and tested on live server: majnuj.com
----------, Jan 4, 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