Interface SkinsApi


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

      All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods 
      Modifier and Type Method Description
      default java.util.Optional<Skin> getOriginalSkin​(@NotNull org.bukkit.entity.Player player)
      Gets the player's skin, which is set on the premium account of this player.
      java.util.Optional<Skin> getSetSkin​(@NotNull org.bukkit.entity.Player player)
      Gets the player's server set skin.
      @NotNull MojangResponse getSkin​(@NotNull java.lang.String username)
      Gets the skin of the specified username by fetching UUID and skin from the mojang api.
      default boolean isSetSkinOriginal​(@NotNull org.bukkit.entity.Player player)
      Returns whenever the set skin of the specified Player equals his original skin.
      boolean setSkin​(@NotNull org.bukkit.entity.Player player, @NotNull MojangResponse skin)
      Sets the skin of the specified player.
      void setSkin​(@NotNull org.bukkit.entity.Player player, @NotNull Skin skin)
      Deprecated.
      always fetches name from mojang api.
    • Method Detail

      • getSetSkin

        java.util.Optional<Skin> getSetSkin​(@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 (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
      • getOriginalSkin

        default java.util.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. Also keep in mind that the skin given could not be updated as the already fetched skins get cached and get updated when ./skinset or a join from the specified skin name occurs.
        Parameters:
        player - the player you want to get the original skin of
        Returns:
        optional of skin if this player is in mojang's database, empty optional otherwise
      • 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 java.lang.String username)
        Gets the skin of the specified username by fetching UUID and skin from the mojang api. The response is never null, however, the parts into the response may be null if the mojang api is down or the server's being rate limited by the mojang api.
        Parameters:
        username - the username of the premium account you want to get skin
        Returns:
        response with all data, or response with none data if mojang api is down or the server's being rate limited.
      • setSkin

        @Deprecated
        void setSkin​(@NotNull
                     @NotNull org.bukkit.entity.Player player,
                     @NotNull
                     @NotNull Skin skin)
        Deprecated.
        always fetches name from mojang api. The alternative is setSkin(Player, MojangResponse)
        Sets the skin of the specified player.
        Parameters:
        player - the player you want to set the skin of
        skin - the skin you want to set on the player
      • 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 mojang responce form that you want to set on the player
        Returns:
        whether or not the skin change was successful