Package de.eldoria.eldoutilities.updater
Class Updater<V extends UpdateResponse,T extends UpdateData<V>>
java.lang.Object
de.eldoria.eldoutilities.updater.Updater<V,T>
- Type Parameters:
T- type of Updater
- All Implemented Interfaces:
Runnable,org.bukkit.event.Listener
- Direct Known Subclasses:
ButlerUpdateChecker,LynaUpdateChecker,SpigotUpdateChecker
public abstract class Updater<V extends UpdateResponse,T extends UpdateData<V>>
extends Object
implements org.bukkit.event.Listener, Runnable
Base implementation for Updater.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbutler(ButlerUpdateData data) Deprecated.Lyna is the prefered way to check for updates.checkUpdate(T data) The check method will be called after the constructor is called.protected HttpClientclient()getData()static Updater<LynaUpdateResponse,LynaUpdateData> lyna(LynaUpdateData data) Create a new lyna update check.final voidperformCheck(boolean silent) Performs an update check with the saved data.voidrun()spigot(SpigotUpdateData data) Create a new spigot update checkervoidstart()Start the update check thread.protected booleanupdate()This version should update the plugin.
-
Constructor Details
-
Updater
-
-
Method Details
-
spigot
Create a new spigot update checker- Parameters:
data- spigot plugin data- Returns:
- Updater instance
-
butler
@Deprecated public static Updater<DefaultUpdateResponse,ButlerUpdateData> butler(ButlerUpdateData data) Deprecated.Lyna is the prefered way to check for updates.Create a new update butler checker- Parameters:
data- butler plugin data- Returns:
- Updater instance
-
lyna
Create a new lyna update check.A Lyna update check is made to work together with a Lyna instance.
Additionally, a
build.datafile is required, which is created by the publishdata plugin.- Parameters:
data- lyna plugin data- Returns:
- Updater instance
-
run
public void run() -
performCheck
public final void performCheck(boolean silent) Performs an update check with the saved data. This can be repeated in a scheduler. -
update
protected boolean update()This version should update the plugin. If not implemented set theUpdateData.isAutoUpdate()to false.- Returns:
- true if the update was succesful.
-
checkUpdate
The check method will be called after the constructor is called.This method should be implemented as follows:
Retrieve the latest version of the plugin from any update service.
return the latest version or a empty optional if the version could not be checked.
- Parameters:
data- data for plugin updates- Returns:
- empty optional if the version could not be checked or the latest version.
-
start
public void start()Start the update check thread.This will check every 6 hours if an update is available.
-
getData
-
client
-