Interface SkinStorage


public interface SkinStorage
There are three types of skins: - Player skins - URL skins - Custom skins
URL skins additionally store an "index"; an index is the skin variant that was generated by MineSkin. That means when you type an url, we'll know whether to automatically choose the slim or classic variant. The user has the option to override the default "index variant" using the command /skin set url variant
A player-skin is stored using the target player's UUID. This way we can, for example, keep using the skin of "Dinnerbone" even if he changes his name to "Spoiledbone". A player-skin may be fetched again if the skin data is outdated. (By timestamp)
A custom skin is stored using the custom skin name. It will never be updated automatically.
  • Method Details

    • updatePlayerSkinData

      Optional<SkinProperty> updatePlayerSkinData(UUID uuid) throws DataRequestException
      This method returns the updated skin property associated to the player skin by UUID. This will always request the latest skin data from Mojang directly no matter whether it's expired or not.
      Parameters:
      uuid - Player UUID
      Returns:
      The skin property containing the skin data
      Throws:
      DataRequestException - If MojangAPI lookup errors (e.g. premium player not found)
    • getPlayerSkin

      Optional<MojangSkinDataResult> getPlayerSkin(String playerName, boolean allowExpired) throws DataRequestException
      Gets the skin data of a Mojang player by name using the UUID cache. This will cache the UUID if it's not already cached and will cache the skin data.
      Parameters:
      playerName - Player name to search for
      allowExpired - Allow expired data to be returned
      Returns:
      The skin data of the player or empty if no such player exists
      Throws:
      DataRequestException - If the data could not be retrieved
    • setPlayerSkinData

      void setPlayerSkinData(UUID uuid, String lastKnownName, SkinProperty textures, long timestamp)
      Saves a player skin to the database.
      Parameters:
      uuid - Player UUID
      lastKnownName - Last known name of the player
      textures - Property object
      timestamp - timestamp string in milliseconds
    • setURLSkinData

      void setURLSkinData(String url, String mineSkinId, SkinProperty textures, SkinVariant skinVariant)
      Saves an url skin to the database.
      Parameters:
      url - URL to skin
      mineSkinId - MineSkin ID
      textures - Property object
      skinVariant - Skin variant
    • setURLSkinIndex

      void setURLSkinIndex(String url, SkinVariant skinVariant)
      Saves an url index to the database.
      Parameters:
      url - URL to skin
      skinVariant - Skin variant
    • setURLSkinByResponse

      default void setURLSkinByResponse(String url, MineSkinResponse response)
      Saves an url to the database using a MineSkinResponse object.
      Parameters:
      url - URL to skin
      response - MineSkinResponse object
    • setCustomSkinData

      void setCustomSkinData(String skinName, SkinProperty textures)
      Saves a custom skin to the database.
      Parameters:
      skinName - Skin name
      textures - Property object
    • findSkinData

      Optional<InputDataResult> findSkinData(String input)
      Searches a skin in the database by name/url.
      Parameters:
      input - Skin name/url
      Returns:
      InputDataResult object or empty if not found
    • findOrCreateSkinData

      Searches a skin in the database by name/url. If not found, it will try to generate it based on the detected type.
      Parameters:
      input - Skin name/url
      Returns:
      InputDataResult object or empty if not found
      Throws:
      DataRequestException - If MojangAPI lookup errors (e.g. premium player not found)
      MineSkinException
    • getSkinDataByIdentifier

      Optional<SkinProperty> getSkinDataByIdentifier(SkinIdentifier identifier)
      Searches a skin in the database by its skin identifier.
      Parameters:
      identifier - Skin identifier
      Returns:
      SkinProperty object or empty if not found
    • removeSkinData

      void removeSkinData(SkinIdentifier identifier)
      Removes a skin from the database by its skin identifier.
      Parameters:
      identifier - Skin identifier