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, Listener
Direct Known Subclasses:
ButlerUpdateChecker, LynaUpdateChecker, SpigotUpdateChecker

public abstract class Updater<V extends UpdateResponse,T extends UpdateData<V>> extends Object implements Listener, Runnable
Base implementation for Updater.
  • Constructor Details

    • Updater

      protected Updater(T data)
  • Method Details

    • spigot

      Create a new spigot update checker
      Parameters:
      data - spigot plugin data
      Returns:
      Updater instance
    • butler

      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.data file is required, which is created by the publishdata plugin.

      Parameters:
      data - lyna plugin data
      Returns:
      Updater instance
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • 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 the UpdateData.isAutoUpdate() to false.
      Returns:
      true if the update was succesful.
    • checkUpdate

      protected abstract Optional<V> checkUpdate(T data)
      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

      public T getData()
    • client

      protected HttpClient client()