Package net.citizensnpcs.trait
Class SkinTrait
java.lang.Object
net.citizensnpcs.api.trait.Trait
net.citizensnpcs.trait.SkinTrait
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears skin texture and name.boolean
Whether to fetch the Mojang skin using the NPC's name on spawn.void
Loads a trait.void
run()
Called every tick if overridden.void
setFetchDefaultSkin
(boolean fetch) void
setShouldUpdateSkins
(boolean update) void
setSkinName
(String name) Sets the skin name - will respawn NPC if spawned.void
setSkinName
(String name, boolean forceUpdate) Sets the skin name - will respawn NPC if spawned.void
setSkinPersistent
(String skinName, String signature, String data) Sets the skin data directly, respawning the NPC if spawned.void
setSkinPersistent
(Player player) Set skin data copying from aPlayer
.void
setTexture
(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:Trait
Loads a trait. -
run
public void run()Description copied from class:Trait
Called every tick if overridden. -
setFetchDefaultSkin
public void setFetchDefaultSkin(boolean fetch) - See Also:
-
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
Set skin data copying from aPlayer
. Not subject to rate limiting from Mojang.- Parameters:
player
- The player to copy
-
setSkinPersistent
Sets the skin data directly, respawning the NPC if spawned.- Parameters:
skinName
- Skin name or cache keysignature
-getSignature()
data
-getTexture()
-
setTexture
-
shouldUpdateSkins
public boolean shouldUpdateSkins()- Returns:
- Whether the skin should be updated from Mojang periodically
-