BackUpPlugin icon

BackUpPlugin -----

Local, FTP, AWS SDK a Google Cloud Storage world backup.




  1. Added Import:
    • The import java.util.stream.Collectors was added to the code. This import is necessary for working with streams and collections in the manageFTPBackups method.
  2. Fixed Error:
    • The error cannot find symbol: variable Collectors was resolved by adding the missing import. This error occurred because the Collectors class was not imported but was used in the manageFTPBackups method.
----------, Mar 9, 2025

  1. Asynchronous Backup:
    • Backup operations (compression, FTP upload) now run in the background, avoiding main thread blocking.

    • Prevents server freezes and crashes caused by long compression tasks.
  2. Improved Performance:
    • Server remains responsive during backups, ensuring no lag for players.
  3. FTP Fallback:
    • If FTP is unavailable, backups are saved locally, and the error is logged without disrupting server functionality.
Why This Was Done:
  • The original code ran backups synchronously, causing the server to freeze if compression took too long.

  • This led to errors like The server has not responded for X seconds! and eventual crashes
----------, Mar 9, 2025

The updated code brings significant improvements in terms of functionality, performance, and user-friendliness. The main changes include:

Switching from numerical backup naming to timestamps.

Adding support for cloud storage (AWS S3 and Google Cloud Storage).

Optimizing FTP connection handling.

Removing redundant backup counters.

Improving the management of old backups.

Expanding configuration options and documentation.

These changes make the plugin more efficient, flexible, and easier to use.
----------, Mar 9, 2025

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: 211
First Release: Jan 4, 2025
Last Update: Mar 9, 2025
Category: ---------------
All-Time Rating:
0 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings