Class AnnoyingDependency


  • public class AnnoyingDependency
    extends xyz.srnyx.javautilities.parents.Stringable
    Represents a downloadable dependency
    • Field Summary

      Fields 
      Modifier and Type Field Description
      boolean enableAfterDownload
      Whether to attempt to enable the dependency after it has been downloaded
      @NotNull java.io.File file
      The new file of the dependency (name.jar)
      @NotNull java.lang.String name
      The name of the dependency (from it's plugin.yml)
      PluginPlatform.Multi platforms
      The platforms the dependency can be downloaded from
      boolean required
      Whether the dependency is required to be installed.
    • Constructor Summary

      Constructors 
      Constructor Description
      AnnoyingDependency​(@NotNull java.lang.String name, boolean required, boolean enableAfterDownload, @NotNull PluginPlatform... platforms)
      Creates a new dependency instance
      AnnoyingDependency​(@NotNull java.lang.String name, boolean required, boolean enableAfterDownload, PluginPlatform.Multi platforms)
      Creates a new dependency instance
      AnnoyingDependency​(@NotNull java.lang.String name, PluginPlatform.Multi platforms, boolean required, boolean enableAfterDownload)
      Creates a new dependency instance
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isNotInstalled()
      This uses Bukkit.getPluginManager() to check if the dependency isn't installed.
      static @NotNull AnnoyingDependency load​(@NotNull org.bukkit.configuration.ConfigurationSection section)
      Loads a dependency from a ConfigurationSection
      static @NotNull java.util.List<AnnoyingDependency> loadList​(@NotNull org.bukkit.configuration.ConfigurationSection section, @NotNull java.lang.String key)
      Loads a list of dependencies from a ConfigurationSection
      • Methods inherited from class xyz.srnyx.javautilities.parents.Stringable

        toString, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • name

        @NotNull
        public final @NotNull java.lang.String name
        The name of the dependency (from it's plugin.yml)
      • platforms

        @NotNull
        public final PluginPlatform.Multi platforms
        The platforms the dependency can be downloaded from
      • required

        public final boolean required
        Whether the dependency is required to be installed. If the download fails and this is true, the plugin will not enable

        This does NOT stop the dependency from being downloaded/installed

      • enableAfterDownload

        public final boolean enableAfterDownload
        Whether to attempt to enable the dependency after it has been downloaded
      • file

        @NotNull
        public final @NotNull java.io.File file
        The new file of the dependency (name.jar)
    • Constructor Detail

      • AnnoyingDependency

        public AnnoyingDependency​(@NotNull
                                  @NotNull java.lang.String name,
                                  @NotNull
                                  PluginPlatform.Multi platforms,
                                  boolean required,
                                  boolean enableAfterDownload)
        Creates a new dependency instance
        Parameters:
        name - name
        platforms - platforms
        required - required
        enableAfterDownload - enableAfterDownload
      • AnnoyingDependency

        public AnnoyingDependency​(@NotNull
                                  @NotNull java.lang.String name,
                                  boolean required,
                                  boolean enableAfterDownload,
                                  @NotNull
                                  PluginPlatform.Multi platforms)
        Creates a new dependency instance
        Parameters:
        name - name
        required - required
        enableAfterDownload - enableAfterDownload
        platforms - platforms
      • AnnoyingDependency

        public AnnoyingDependency​(@NotNull
                                  @NotNull java.lang.String name,
                                  boolean required,
                                  boolean enableAfterDownload,
                                  @NotNull
                                  @NotNull PluginPlatform... platforms)
        Creates a new dependency instance
        Parameters:
        name - name
        required - required
        enableAfterDownload - enableAfterDownload
        platforms - platforms
    • Method Detail

      • load

        @NotNull
        public static @NotNull AnnoyingDependency load​(@NotNull
                                                       @NotNull org.bukkit.configuration.ConfigurationSection section)
        Loads a dependency from a ConfigurationSection
        Parameters:
        section - the section to load from
        Returns:
        the loaded dependency
      • loadList

        @NotNull
        public static @NotNull java.util.List<AnnoyingDependency> loadList​(@NotNull
                                                                           @NotNull org.bukkit.configuration.ConfigurationSection section,
                                                                           @NotNull
                                                                           @NotNull java.lang.String key)
        Loads a list of dependencies from a ConfigurationSection
        Parameters:
        section - the section to load from
        key - the key to load from
        Returns:
        the loaded dependencies
      • isNotInstalled

        public boolean isNotInstalled()
        This uses Bukkit.getPluginManager() to check if the dependency isn't installed. So it's vital that name is from the plugin's plugin.yml
        Returns:
        whether the dependency isn't currently installed