Interface SkinsApi


  • public interface SkinsApi
    Represents the main object of the skins api.
    • Method Detail

      • getSetSkin

        @Deprecated
        Optional<Skin> getSetSkin​(@NotNull
                                  @NotNull org.bukkit.entity.Player player)
        Deprecated.
        this method will always take from cache without updating the skin, use getSetSkinResponse(Player)
        Gets the player's server set skin. This could also return getOriginalSkin(Player) due to how the plugin handles storing skins (to check that you can call isSetSkinOriginal(Player))
        Parameters:
        player - the player you want to get the set skin of
        Returns:
        optional of skin if the player have changed their skin, empty optional otherwise
      • getSetSkinResponse

        @NotNull
        @NotNull MojangResponse getSetSkinResponse​(@NotNull
                                                   @NotNull org.bukkit.entity.Player player)
        Gets the player's server set skin. This could also return getOriginalSkin(Player) due to how the plugin handles storing skins. The skin will be always updated if can.
        Parameters:
        player - the player you want to get the set skin of
        Returns:
        response
      • getOriginalSkin

        @Deprecated
        default Optional<Skin> getOriginalSkin​(@NotNull
                                               @NotNull org.bukkit.entity.Player player)
        Gets the player's skin, which is set on the premium account of this player. This might be null if the specified player's nickname has no premium account.
        Parameters:
        player - the player you want to get the original skin of
        Returns:
        optional of skin if this player is in the data provider's database, empty optional otherwise
      • getOriginalSkinResponse

        @NotNull
        default @NotNull MojangResponse getOriginalSkinResponse​(@NotNull
                                                                @NotNull org.bukkit.entity.Player player)
        Gets the player's skin, which is set on the premium account of this player.
        Parameters:
        player - the player you want to get the original skin of
        Returns:
        response
        See Also:
        getSkin(String)
      • isSetSkinOriginal

        default boolean isSetSkinOriginal​(@NotNull
                                          @NotNull org.bukkit.entity.Player player)
        Returns whenever the set skin of the specified Player equals his original skin.
        Parameters:
        player - the player you want to check's skin
        Returns:
        true if equal, false otherwise
      • getSkin

        @NotNull
        @NotNull MojangResponse getSkin​(@NotNull
                                        @NotNull String username)
        Gets the skin of the specified username by fetching UUID and skin from the DataProvider set. The response is never null, however, the parts into the response may be null if the data provider wasn't able to fetch them, for one reason or another. It is recommended to run this asynchronously.
        Parameters:
        username - the username of the premium account you want to get skin
        Returns:
        response with all data, or response with none data if data provider wasn't able to fetch it
      • setSkin

        boolean setSkin​(@NotNull
                        @NotNull org.bukkit.entity.Player player,
                        @NotNull
                        @NotNull MojangResponse skin)
        Sets the skin of the specified player.
        Parameters:
        player - the player you want to set the skin of
        skin - the skin in response form that you want to set on the player
        Returns:
        whether or not the skin change was successful
      • setDataProvider

        void setDataProvider​(@NotNull
                             @NotNull DataProvider dataProvider)
        Sets a new data provider, for fetching skin and uuid information.
        Parameters:
        dataProvider - data provider
      • getVersionInfo

        @NotNull
        @NotNull SkinsVersionInfo getVersionInfo()
        Returns the plugin's version info.
        Returns:
        detailed information object about the version of the plugin, implementing this api.
      • getSkullOwner

        @Nullable
        @Nullable MojangResponse getSkullOwner​(@NotNull
                                               @NotNull org.bukkit.inventory.ItemStack item)
        Returns the skull owner of the item, if the item is a skull item and was generated by the SkullItemBuilder.
        Parameters:
        item - item you want to get the skull owner of
        Returns:
        response