Class License


  • public class License
    extends Object
    • Constructor Detail

      • License

        public License​(LicenseStatus status,
                       String licenseKey,
                       ArrayList<String> groups,
                       ArrayList<String> permissions,
                       ArrayList<LicenseMeta> meta,
                       int maxUses,
                       int currentUses,
                       Date expirationDate)
        Creates a new license object with the given parameters
        Parameters:
        status - The status of the license
        licenseKey - The license key
        groups - The groups of the license
        permissions - The permissions of the license
        meta - The meta information of the license
        maxUses - The maximum amount of uses of the license
        currentUses - The current amount of uses of the license
        expirationDate - The expiration date of the license
    • Method Detail

      • isValid

        public boolean isValid()
        Checks if the license is valid
        Returns:
        true if the license is valid and false if not
      • isExpired

        public boolean isExpired()
        Checks if the license has expired
        Returns:
        true if the license has expired and false if not
      • isMaxUsesReached

        public boolean isMaxUsesReached()
        Checks if the license has reached the maximum amount of uses (if the maximum amount of uses is set)
        Returns:
        true if the license has reached the maximum amount of uses and false if not
      • getLicenseKey

        public String getLicenseKey()
        Gets the current license key. If the license key is invalid, this method will return null
        Returns:
        the current license key
      • getGroups

        public ArrayList<String> getGroups()
        Gets all groups of the license
        Returns:
        all groups of the license
      • hasGroup

        public boolean hasGroup​(String group)
        Checks if the license has a specific group
        Parameters:
        group - The group you want to check
        Returns:
        true if the license has the group and false if not
      • getPermissions

        public ArrayList<String> getPermissions()
        Gets all permissions of the license
        Returns:
        all permissions of the license
      • hasPermission

        public boolean hasPermission​(String permission)
        Checks if the license has a specific permission
        Parameters:
        permission - The permission you want to check
        Returns:
        true if the license has the permission and false if not
      • getMeta

        public ArrayList<LicenseMeta> getMeta()
        Gets all meta information of the license
        Returns:
        all meta information of the license
      • getMeta

        public String getMeta​(String key)
        Gets a specific meta information of the license. If the meta information does not exist, this method will return null
        Parameters:
        key - The key of the meta information you want to get
        Returns:
        the value of the meta information
      • getMaxUses

        public int getMaxUses()
        Gets the maximum amount of uses of the license. If the maximum amount of uses is not set, this method will return -1
        Returns:
        the maximum amount of uses of the license
      • getCurrentUses

        public int getCurrentUses()
        Gets the current amount of uses of the license
        Returns:
        the current amount of uses of the license
      • getExpirationDate

        public Date getExpirationDate()
        Gets the expiration date of the license. If the license has no expiration date, this method will return null
        Returns:
        the expiration date of the license