Package net.citizensnpcs.trait
Class SkinTrait
java.lang.Object
net.citizensnpcs.api.trait.Trait
net.citizensnpcs.trait.SkinTrait
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears skin texture and name.booleanWhether to fetch the Mojang skin using the NPC's name on spawn.voidLoads a trait.voidrun()Called every tick if overridden.voidsetFetchDefaultSkin(boolean fetch) voidsetShouldUpdateSkins(boolean update) voidsetSkinName(String name) Sets the skin name - will respawn NPC if spawned.voidsetSkinName(String name, boolean forceUpdate) Sets the skin name - will respawn NPC if spawned.voidsetSkinPersistent(String skinName, String signature, String data) Sets the skin data directly, respawning the NPC if spawnedvoidsetTexture(String value, String signature) boolean
-
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
- Returns:
- The texture signature, or null
-
getSkinName
- Returns:
- The skin name if set, or null (i.e. using the NPC's name)
-
getTexture
- Returns:
- The encoded texture data, or null
-
load
Description copied from class:TraitLoads a trait. -
run
public void run()Description copied from class:TraitCalled every tick if overridden. -
setFetchDefaultSkin
public void setFetchDefaultSkin(boolean fetch) - See Also:
-
fetchDefaultSkin
-
setShouldUpdateSkins
public void setShouldUpdateSkins(boolean update) - See Also:
-
setSkinName
Sets the skin name - will respawn NPC if spawned.- Parameters:
name- The skin name
-
setSkinName
Sets the skin name - will respawn NPC if spawned.- Parameters:
name- The skin nameforceUpdate- Whether to force update if no data has been fetched yet- See Also:
-
setSkinPersistent
Sets the skin data directly, respawning the NPC if spawned- Parameters:
skinName- Skin name, for caching purposessignature-getSignature()data-getTexture()
-
setTexture
-
shouldUpdateSkins
public boolean shouldUpdateSkins()- Returns:
- Whether the skin should be updated from Mojang periodically
-