Class ResourcePack

java.lang.Object
de.themoep.resourcepacksplugin.core.ResourcePack

public class ResourcePack extends Object
Created by Phoenix616 on 25.03.2015.
  • Constructor Details

    • ResourcePack

      public ResourcePack(String name, String url, String hash)
      Object representation of a resourcepack set in the plugin's config file.
      Parameters:
      name - The name of the resourcepack as set in the config. Serves as an unique identifier. Correct case.
      url - The url where this resourcepack is located at and where the client will download it from
      hash - The hash set for this resourcepack. Ideally this is the zip file's sha1 hash.
    • ResourcePack

      public ResourcePack(String name, UUID uuid, String url, String hash)
      Object representation of a resourcepack set in the plugin's config file.
      Parameters:
      name - The name of the resourcepack as set in the config. Serves as an unique identifier. Correct case.
      uuid - The uuid of the resourcepack as set in the config.
      url - The url where this resourcepack is located at and where the client will download it from
      hash - The hash set for this resourcepack. Ideally this is the zip file's sha1 hash.
    • ResourcePack

      public ResourcePack(String name, String url, String hash, int format)
      Object representation of a resourcepack set in the plugin's config file.
      Parameters:
      name - The name of the resourcepack as set in the config. Serves as an unique identifier. Correct case.
      url - The url where this resourcepack is located at and where the client will download it from
      hash - The hash set for this resourcepack. Ideally this is the zip file's sha1 hash.
      format - The version of this resourcepack as defined in the pack.mcmeta
    • ResourcePack

      public ResourcePack(String name, String url, String hash, boolean restricted)
      Object representation of a resourcepack set in the plugin's config file.
      Parameters:
      name - The name of the resourcepack as set in the config. Serves as an unique identifier. Correct case.
      url - The url where this resourcepack is located at and where the client will download it from
      hash - The hash set for this resourcepack. Ideally this is the zip file's sha1 hash.
      restricted - Whether or not this pack should only be send to players with the pluginname.pack.packname permission
    • ResourcePack

      public ResourcePack(String name, String url, String hash, int format, boolean restricted)
      Object representation of a resourcepack set in the plugin's config file.
      Parameters:
      name - The name of the resourcepack as set in the config. Serves as an unique identifier. Correct case.
      url - The url where this resourcepack is located at and where the client will download it from
      hash - The hash set for this resourcepack. Ideally this is the zip file's sha1 hash.
      format - The version of this resourcepack as defined in the pack.mcmeta as pack_format
      restricted - Whether or not this pack should only be send to players with the pluginname.pack.packname permission
    • ResourcePack

      public ResourcePack(String name, String url, String hash, int format, boolean restricted, String permission)
      Object representation of a resourcepack set in the plugin's config file.
      Parameters:
      name - The name of the resourcepack as set in the config. Serves as an uinque identifier. Correct case.
      url - The url where this resourcepack is located at and where the client will download it from
      hash - The hash set for this resourcepack. Ideally this is the zip file's sha1 hash.
      format - The version of this resourcepack as defined in the pack.mcmeta as pack_format
      permission - A custom permission for this pack
      restricted - Whether or not this pack should only be send to players with the pluginname.pack.packname permission
    • ResourcePack

      public ResourcePack(String name, String url, String hash, int format, int version, boolean restricted, String permission)
      Object representation of a resourcepack set in the plugin's config file.
      Parameters:
      name - The name of the resourcepack as set in the config. Serves as an uinque identifier. Correct case.
      url - The url where this resourcepack is located at and where the client will download it from
      hash - The hash set for this resourcepack. Ideally this is the zip file's sha1 hash.
      format - The version of this resourcepack as defined in the pack.mcmeta as pack_format
      version - The Minecraft version that this resourcepack is for
      permission - A custom permission for this pack
      restricted - Whether or not this pack should only be send to players with the pluginname.pack.packname permission
    • ResourcePack

      public ResourcePack(String name, String url, String hash, int format, int version, boolean restricted, String permission, ClientType type)
      Object representation of a resourcepack set in the plugin's config file.
      Parameters:
      name - The name of the resourcepack as set in the config. Serves as an uinque identifier. Correct case.
      url - The url where this resourcepack is located at and where the client will download it from
      hash - The hash set for this resourcepack. Ideally this is the zip file's sha1 hash.
      format - The version of this resourcepack as defined in the pack.mcmeta as pack_format
      version - The Minecraft version that this resourcepack is for
      permission - A custom permission for this pack
      restricted - Whether or not this pack should only be send to players with the pluginname.pack.packname permission
      type - The type of the pack depending on the client which should receive it
    • ResourcePack

      public ResourcePack(String name, String url, String hash, String localPath, int format, int version, boolean restricted, String permission, ClientType type)
      Object representation of a resourcepack set in the plugin's config file.
      Parameters:
      name - The name of the resourcepack as set in the config. Serves as an unique identifier. Correct case.
      url - The url where this resourcepack is located at and where the client will download it from
      hash - The hash set for this resourcepack. Ideally this is the zip file's sha1 hash.
      localPath - The local path to this resourcepack. Ideally this points to the same file as the url points to.
      format - The version of this resourcepack as defined in the pack.mcmeta as pack_format
      version - The Minecraft version that this resourcepack is for
      permission - A custom permission for this pack
      restricted - Whether or not this pack should only be send to players with the pluginname.pack.packname permission
      type - The type of the pack depending on the client which should receive it
    • ResourcePack

      public ResourcePack(String name, UUID uuid, String url, String hash, String localPath, int format, int version, boolean restricted, String permission, ClientType type)
      Object representation of a resourcepack set in the plugin's config file.
      Parameters:
      name - The name of the resourcepack as set in the config. Serves as an unique identifier. Correct case.
      uuid - The uuid of the resourcepack as set in the config.
      url - The url where this resourcepack is located at and where the client will download it from
      hash - The hash set for this resourcepack. Ideally this is the zip file's sha1 hash.
      localPath - The local path to this resourcepack. Ideally this points to the same file as the url points to.
      format - The version of this resourcepack as defined in the pack.mcmeta as pack_format
      version - The Minecraft version that this resourcepack is for
      permission - A custom permission for this pack
      restricted - Whether or not this pack should only be send to players with the pluginname.pack.packname permission
      type - The type of the pack depending on the client which should receive it
  • Method Details

    • getName

      public String getName()
      Get the name of the resourcepack as set in the config. Serves as an uinque identifier. Correct case.
      Returns:
      The name as a string in correct case
    • getUuid

      public UUID getUuid()
      Get the universally unique identifier (UUID) associated with the resource pack.
      Returns:
      The UUID as an instance of the UUID class.
    • setUuid

      public void setUuid(UUID uuid)
      Set the universally unique identifier (UUID) associated with the resource pack.
      Parameters:
      uuid - The UUID of the resource pack.
    • getUrl

      public String getUrl()
      Get the url where this resourcepack is located at and where the client will download it from
      Returns:
      The url as a string
    • getHash

      public String getHash()
      Get the hash set for this resourcepack. Ideally this is the zip file's sha1 hash.
      Returns:
      The 40 digit lowercase hash
    • getRawHash

      public byte[] getRawHash()
    • setRawHash

      public void setRawHash(byte[] hash)
    • getLocalPath

      public String getLocalPath()
      Get the local path where this resourcepack is located at on your file system
      Returns:
      The path as a string
    • getFormat

      public int getFormat()
      Get the pack format version
      Returns:
      The pack version as an int
    • setFormat

      public boolean setFormat(int format)
      Set the pack format version
      Parameters:
      format - The pack version as an int
      Returns:
      Whether or not the format changed
    • getVersion

      public int getVersion()
      Get the pack Minecraft protocol version
      Returns:
      The Minecraft protocol version as an int
    • setVersion

      public boolean setVersion(int version)
      Set the pack Minecraft protocol version
      Parameters:
      version - The Minecraft protocol version as an int
    • setVersion

      public boolean setVersion(String versionString)
      Utility method to set the pack Minecraft version from a string
      Parameters:
      versionString - The Minecraft version as string descriptor
      Throws:
      IllegalArgumentException - Thrown when the string is not valid
    • isRestricted

      public boolean isRestricted()
      Whether or not this pack is restricted and a permission should be used
      Returns:
      true if one needs the permission, false if not
    • setRestricted

      public boolean setRestricted(boolean restricted)
      Whether or not this pack is restricted and a permission should be used
      Parameters:
      restricted - true if one needs the permission, false if not
      Returns:
      Whether or not the restricted status changed
    • getPermission

      public String getPermission()
      Get the permission to use this pack
      Returns:
      The permission as a string
    • setPermission

      public boolean setPermission(String permission)
      Set the permission to use this pack
      Parameters:
      permission - The permission as a string
      Returns:
      Whether or not the permission changed
    • getType

      public ClientType getType()
      Get the client type that the resource pack is for
      Returns:
      The type
    • setType

      public boolean setType(ClientType type)
      Set the client type that the resource pack is for
      Parameters:
      type - The type
      Returns:
      Whether or not the ClientType changed
    • getVariants

      public List<ResourcePack> getVariants()
      Get a list of different pack variants. Used to get, add and remove variants.
      Returns:
      The list of pack variants
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getReplacements

      public String[] getReplacements()
    • serialize

      public Map<String,Object> serialize()