Using the API - MaxMaeder/DriveBackupV2 GitHub Wiki
Customize the behavior of DriveBackupV2 using its powerful API. This guide assumes you have prior knowledge of how to create Bukkit plugins.
Since v1.3.2
In your Maven project's pom.xml
, add the following text under <repositories>
:
<repository>
<id>DriveBackupV2-mvn-repo</id>
<url>https://raw.githubusercontent.com/MaxMaeder/DriveBackupV2/mvn-repo/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
Under <dependencies>
, add the following text:
<dependency>
<groupId>ratismal</groupId>
<artifactId>DriveBackupV2</artifactId>
<version>PLUGIN_VERSION</version>
</dependency>
Replace PLUGIN_VERSION
with the version of DriveBackupV2 you have installed.
If your plugin can function without DriveBackupV2, add DriveBackupV2
to the softdepend
list in your plugin's plugin.yml
, like so:
softdepend: [DriveBackupV2]
Otherwise, add it to the depend
list, like so:
depend: [DriveBackupV2]
In addition to completing the above steps, you will need to import the DriveBackupV2
class in order to use the API.
Add the following text to the top of any files you plan on using the API in:
import ratismal.drivebackup.DriveBackupApi;
Runs the specified Callable
after a backup has been initiated (either manually using /drivebackup backup
or the API, or automatically with scheduled or interval-based backups), but before the backup process has been started.
Multiple Callable
s can be specified by calling this method multiple times.
If any Callable
returns false, the backup will be canceled.
If the Callable
doesn't return in 10 seconds, the Callable
will be ignored.
- Parameters:
-
callable the
Callable
-
callable the
Runs the specified Runnable
in a new thread after a backup is successfully completed.
- Parameters:
-
runnable the
Runnable
-
runnable the
Runs the specified Runnable
in a new thread after the backup system completes with an error.
- Parameters:
-
runnable the
Runnable
-
runnable the
Starts a backup.
Behaves identically to running /drivebackup backup
.
Reloads the plugin's config.yml
.
Behaves identically to running /drivebackup reloadconfig
.
Returns the message sent to chat when /drivebackup nextbackup
is run.
For more information about the /drivebackup nextbackup
command, see this.
- Returns:
- the message
View the code of and download several example plugins using the API here.