Class VersionProvider

java.lang.Object
net.skinsrestorer.api.VersionProvider

public class VersionProvider extends Object
This class is a helper class for third-party plugins to check whether their used API version is compatible with the version of SkinsRestorer installed on the server.

If this class is not available, the plugin is using an outdated version of the API. (V14 or below)

Since:
15.0.0
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    Returns the 40 letter git commit of SkinsRestorer installed on the server.
    static int[]
    Returns the semantic version of SkinsRestorer installed on the server for a third-party plugin to use for detecting the version of SkinsRestorer installed on the server to find the right API implementation to use.
    static String
    Returns the version of SkinsRestorer installed on the server.
    static String
    Returns the version of SkinsRestorer installed on the server for a third-party plugin to use for a message.
    static boolean
    Checks whether the given API version is compatible with the version of SkinsRestorer installed on the server.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • VersionProvider

      public VersionProvider()
  • Method Details

    • isCompatibleWith

      public static boolean isCompatibleWith(String version)
      Checks whether the given API version is compatible with the version of SkinsRestorer installed on the server. If not, the plugin should notify the server admin that the server is using an unsupported version of SkinsRestorer and that the plugin might not work correctly. The version string must be in the format "major", "major.minor" or "major.minor.patch".
      Parameters:
      version - The version to check (e.g. "15", "15.1" or "15.1.2")
      Returns:
      true if the version is compatible, false otherwise. The behavior currently is if the major version is different, the API is not compatible. But this might change in the future.
    • getVersionInfo

      public static String getVersionInfo()
      Returns the version of SkinsRestorer installed on the server for a third-party plugin to use for a message. E.g. "Expected SkinsRestorer 16.0.0+, but found [SkinsRestorer 15.0.0 (a1b2c3d)]".
      Returns:
      The version of SkinsRestorer installed on the server. The format is "SkinsRestorer [version] ([first six letters of commit])" but might change in the future. (e.g. "SkinsRestorer 15.0.0 (a1b2c3d)")
    • getSemanticVersion

      public static int[] getSemanticVersion()
      Returns the semantic version of SkinsRestorer installed on the server for a third-party plugin to use for detecting the version of SkinsRestorer installed on the server to find the right API implementation to use.
      Returns:
      The semantic version of SkinsRestorer installed on the server. (e.g. [15, 1, 2] for "15.1.2")
    • getVersion

      public static String getVersion()
      Returns the version of SkinsRestorer installed on the server.
      Returns:
      The version of SkinsRestorer installed on the server. (e.g. "15.1.2")
    • getCommit

      public static String getCommit()
      Returns the 40 letter git commit of SkinsRestorer installed on the server.
      Returns:
      The 40 letter git commit of SkinsRestorer installed on the server.