Class Skin

java.lang.Object
net.citizensnpcs.npc.skin.Skin

public class Skin extends Object
Stores data for a single skin.
  • Field Details

    • CACHED_SKIN_UUID_METADATA

      public static String CACHED_SKIN_UUID_METADATA
    • CACHED_SKIN_UUID_NAME_METADATA

      public static String CACHED_SKIN_UUID_NAME_METADATA
  • Method Details

    • apply

      public boolean apply(SkinnableEntity entity)
      Apply the skin data to the specified skinnable entity.

      If invoked before the skin data is ready, the skin is retrieved and the skin is automatically applied to the entity at a later time.

      Parameters:
      entity - The skinnable entity.
      Returns:
      True if skin was applied, false if the data is being retrieved.
    • applyAndRespawn

      public void applyAndRespawn(SkinnableEntity entity)
      Apply the skin data to the specified skinnable entity and respawn the NPC.
      Parameters:
      entity - The skinnable entity.
    • getSkinId

      @Nullable public UUID getSkinId()
      Get the ID of the player the skin belongs to.
      Returns:
      The skin ID or null if it has not been retrieved yet or the skin is invalid.
    • getSkinName

      public String getSkinName()
      Get the name of the skin.
    • hasSkinData

      public boolean hasSkinData()
      Determine if the skin data has been retrieved.
    • isValid

      public boolean isValid()
      Determine if the skin is valid.
    • clearCache

      public static void clearCache()
      Clear all cached skins.
    • get

      public static Skin get(SkinnableEntity entity)
      Get a skin for a skinnable entity.

      If a Skin instance does not exist, a new one is created and the skin data is automatically fetched.

      Parameters:
      entity - The skinnable entity.
    • get

      public static Skin get(SkinnableEntity entity, boolean forceUpdate)
      Get a skin for a skinnable entity.

      If a Skin instance does not exist, a new one is created and the skin data is automatically fetched.

      Parameters:
      entity - The skinnable entity.
      forceUpdate - if the skin should be checked via the cache
    • get

      public static Skin get(String skinName, boolean forceUpdate)
      Get a player skin.

      If a Skin instance does not exist, a new one is created and the skin data is automatically fetched.

      Parameters:
      skinName - The name of the skin.