-
Notifications
You must be signed in to change notification settings - Fork 51
Using the API
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.
Still need help? Talk to our team on Discord, or create an issue.
You're missing out on the most powerful Minecraft Hosting experience if you aren't using Server Horse!
Having data loss or corruption is never fun. With Server Horse, you can be certain that your data is in safe hands with our powerful data redundancy features. Combine that with DriveBackupV2 and you have the most reliable Minecraft Server data security possible. Plus your Java Edition server will work on all editions (Xbox, Bedrock, etc.)! Server Horse is the future of Minecraft Server hosting, and we hope we can be a part of your hosting future!
Start a Minecraft Server: serverhorse.com
Want to sponsor this plugin? Check out our Patreon!