public class Updater
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Updater.UpdateResult
Gives the dev the result of the update process.
|
static class |
Updater.UpdateType
Allows the dev to specify the type of update that will be run.
|
Modifier and Type | Field and Description |
---|---|
static ReportType |
REPORT_CANNOT_UPDATE_PLUGIN |
Constructor and Description |
---|
Updater(org.bukkit.plugin.Plugin plugin,
int id,
java.io.File file,
Updater.UpdateType type,
boolean announce)
Initialize the updater.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(java.lang.Runnable listener)
Add a listener to be executed when we have determined if an update is available.
|
java.lang.String |
getLatestFileLink()
Get the latest version's file link.
|
java.lang.String |
getLatestGameVersion()
Get the latest version's game version.
|
java.lang.String |
getLatestName()
Get the latest version's name.
|
java.lang.String |
getLatestType()
Get the latest version's release type (release, beta, or alpha).
|
Updater.UpdateResult |
getResult()
Get the result of the update process.
|
boolean |
isChecking()
Determine if we are already checking for an update.
|
boolean |
removeListener(java.lang.Runnable listener)
Remove a listener.
|
void |
start(Updater.UpdateType type)
Begin looking for updates.
|
public static final ReportType REPORT_CANNOT_UPDATE_PLUGIN
public Updater(org.bukkit.plugin.Plugin plugin, int id, java.io.File file, Updater.UpdateType type, boolean announce)
Call #start()
to actually start looking (and downloading) updates.
plugin
- The plugin that is checking for an update.id
- The dev.bukkit.org id of the projectfile
- The file that the plugin is running from, get this by doing this.getFile() from within your main class.type
- Specify the type of update this will be. See Updater.UpdateType
announce
- True if the program should announce the progress of new updates in consolepublic void start(Updater.UpdateType type)
type
- - the update type.public void addListener(java.lang.Runnable listener)
The listener will be executed on the main thread.
listener
- - the listener to add.public boolean removeListener(java.lang.Runnable listener)
listener
- - the listener to remove.public Updater.UpdateResult getResult()
public java.lang.String getLatestType()
public java.lang.String getLatestGameVersion()
public java.lang.String getLatestName()
public java.lang.String getLatestFileLink()
public boolean isChecking()