Sueta

LightBackup +API

1.0 BETA

Lightweight backup plugin.

·Plugin


API Examples

Events:

//Gets called whenever a backup is completed.
    @EventHandler
    public void onBackupComplete(BackupCompleteEvent e) {
        File backup = new File(e.getSavedPath());
    }
 
    //Gets called whenever a backup is started.
    @EventHandler
    public void onBackupStart(BackupStartEvent e) {
        File backup = new File(e.getSavedPath());
    }
 
    //Gets called whenever a backup fails.
    @EventHandler
    public void onBackupFail(BackupFailEvent e) {
        File backup = new File(e.getSavedPath());
    }

Methodes:

private void lightBackupAPI() {
        //Gets an instance of the LightBackupAPI.
        LightBackupAPI api = LightBackupAPI.getInstance();
     
        //Gets the config.yml file of the LightBackup plugin folder.
        FileConfiguration configuration = api.getFileConfiguration();
     
        //Creates a backup according to the config.yml file of the LightBackup plugin folder.
        api.createBackup();
    }
Yaml Files

Plugin.yml

name: LightBackup
version: 1.0 BETA
main: nl.tabuu.lightbackup.LightBackup
description: Lightweight backup plugin.
authors: [Tabuu]
website: https://www.tabuu.nl

commands:
  lightbackup:
    usage: /lightbackup
    description: Help message.
    aliases: [lb]
  lightbackup help:
    usage: /lightbackup help
    description: Help message.
  lightbackup createbackup:
    usage: /lightbackup createbackup
    description: Creates a backup.
  lightbackup list:
    usage: /lightbackup list
    description: Shows a list of all the backups.
permissions:
  lightbackup.createbackup:
    description: Allows players to use the '/lightbackup create' command.
    default: op
  lightbackup.notify:
    description: Notifies player about the status of a backup.
    default: op
  lightbackup.list:
    description: Allows players to use the '/lightbackup list' command.
    default: op

Config.yml

SavePath: 'plugins/LightBackup/backups/'
BackupPrefix: 'Backup_'

# https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
DateFormat: ddMMMMyyyy-HHmmss

IgnoredPaths:
  - 'plugins'
  - 'spigot-1.12.2.jar'
  - 'start.cmd'

Similar projects

Plugin →