Class SkinTrait

java.lang.Object
net.citizensnpcs.api.trait.Trait
net.citizensnpcs.trait.SkinTrait
All Implemented Interfaces:
Runnable, Listener

public class SkinTrait extends Trait
  • Constructor Details

    • SkinTrait

      public SkinTrait()
  • Method Details

    • clearTexture

      public void clearTexture()
      Clears skin texture and name.
    • fetchDefaultSkin

      public boolean fetchDefaultSkin()
      Whether to fetch the Mojang skin using the NPC's name on spawn.
    • getSignature

      public String getSignature()
      Returns:
      The texture signature, or null
    • getSkinName

      public String getSkinName()
      Returns:
      The skin name if set, or null (i.e. using the NPC's name)
    • getTexture

      public String getTexture()
      Returns:
      The encoded texture data, or null
    • load

      public void load(DataKey key)
      Description copied from class: Trait
      Loads a trait.
      Overrides:
      load in class Trait
      Parameters:
      key - DataKey to load from
    • run

      public void run()
      Description copied from class: Trait
      Called every tick if overridden.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Trait
    • setFetchDefaultSkin

      public void setFetchDefaultSkin(boolean fetch)
      See Also:
      • fetchDefaultSkin
    • setShouldUpdateSkins

      public void setShouldUpdateSkins(boolean update)
      See Also:
    • setSkinName

      public void setSkinName(String name)
      Sets the skin name - will respawn NPC if spawned.
      Parameters:
      name - The skin name
    • setSkinName

      public void setSkinName(String name, boolean forceUpdate)
      Sets the skin name - will respawn NPC if spawned.
      Parameters:
      name - The skin name
      forceUpdate - Whether to force update if no data has been fetched yet
      See Also:
    • setSkinPersistent

      public void setSkinPersistent(Player player)
      Set skin data copying from a Player. Not subject to rate limiting from Mojang.
      Parameters:
      player - The player to copy
    • setSkinPersistent

      public void setSkinPersistent(String skinName, String signature, String data)
      Sets the skin data directly, respawning the NPC if spawned.
      Parameters:
      skinName - Skin name or cache key
      signature - getSignature()
      data - getTexture()
    • setTexture

      public void setTexture(String value, String signature)
    • shouldUpdateSkins

      public boolean shouldUpdateSkins()
      Returns:
      Whether the skin should be updated from Mojang periodically