Enum Class DependencyRepository

java.lang.Object
java.lang.Enum<DependencyRepository>
me.lucko.luckperms.common.dependencies.DependencyRepository
All Implemented Interfaces:
Serializable, Comparable<DependencyRepository>, java.lang.constant.Constable

public enum DependencyRepository extends Enum<DependencyRepository>
Represents a repository which contains Dependencys.
  • Enum Constant Details

    • MAVEN_CENTRAL_MIRROR

      public static final DependencyRepository MAVEN_CENTRAL_MIRROR
      Maven Central mirror repository.

      This is used to reduce the load on repo.maven.org.

      Although Maven Central is technically a CDN, it is meant for developer use, not end-user products. It is trivial and not very expensive for us to provide a mirror, which will absorb any traffic caused by LP.

      LuckPerms will fallback to the real-thing if the mirror ever goes offline. Retrieved content is validated with a checksum, so there is no risk to integrity.

    • MAVEN_CENTRAL

      public static final DependencyRepository MAVEN_CENTRAL
      Maven Central.
  • Method Details

    • values

      public static DependencyRepository[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DependencyRepository valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • openConnection

      protected URLConnection openConnection(Dependency dependency) throws IOException
      Opens a connection to the given dependency.
      Parameters:
      dependency - the dependency to download
      Returns:
      the connection
      Throws:
      IOException - if unable to open a connection
    • downloadRaw

      public byte[] downloadRaw(Dependency dependency) throws DependencyDownloadException
      Downloads the raw bytes of the dependency.
      Parameters:
      dependency - the dependency to download
      Returns:
      the downloaded bytes
      Throws:
      DependencyDownloadException - if unable to download
    • download

      public byte[] download(Dependency dependency) throws DependencyDownloadException
      Downloads the raw bytes of the dependency, and ensures the downloaded bytes match the checksum.
      Parameters:
      dependency - the dependency to download
      Returns:
      the downloaded bytes
      Throws:
      DependencyDownloadException - if unable to download
    • download

      public void download(Dependency dependency, Path file) throws DependencyDownloadException
      Downloads the the dependency to the file, ensuring the downloaded bytes match the checksum.
      Parameters:
      dependency - the dependency to download
      file - the file to write to
      Throws:
      DependencyDownloadException - if unable to download