Class NpcData
java.lang.Object
de.oliver.fancynpcs.api.NpcData
-
Constructor Summary
ConstructorsConstructorDescriptionNpcData(String id, String name, UUID creator, String displayName, SkinData skin, org.bukkit.Location location, boolean showInTab, boolean spawnEntity, boolean collidable, boolean glowing, net.kyori.adventure.text.format.NamedTextColor glowingColor, org.bukkit.entity.EntityType type, Map<NpcEquipmentSlot, org.bukkit.inventory.ItemStack> equipment, boolean turnToPlayer, int turnToPlayerDistance, Consumer<org.bukkit.entity.Player> onClick, Map<ActionTrigger, List<NpcAction.NpcActionData>> actions, float interactionCooldown, float scale, int visibilityDistance, Map<NpcAttribute, String> attributes, boolean mirrorSkin) Creates a default npc with random id -
Method Summary
Modifier and TypeMethodDescriptionaddAction(ActionTrigger trigger, int order, NpcAction action, String value) voidaddAttribute(NpcAttribute attribute, String value) addEquipment(NpcEquipmentSlot slot, org.bukkit.inventory.ItemStack item) voidapplyAllAttributes(Npc npc) voidgetActions(ActionTrigger trigger) Map<NpcEquipmentSlot, org.bukkit.inventory.ItemStack> net.kyori.adventure.text.format.NamedTextColorgetId()floatorg.bukkit.LocationgetName()Consumer<org.bukkit.entity.Player> floatgetScale()intGets the turn-to-player distance for this NPC.org.bukkit.entity.EntityTypegetType()intbooleanbooleanisDirty()booleanbooleanbooleanbooleanbooleanremoveAction(ActionTrigger trigger, NpcAction action) setActions(ActionTrigger trigger, List<NpcAction.NpcActionData> actions) setActions(Map<ActionTrigger, List<NpcAction.NpcActionData>> actions) setCollidable(boolean collidable) voidsetDirty(boolean dirty) setDisplayName(String displayName) setEquipment(Map<NpcEquipmentSlot, org.bukkit.inventory.ItemStack> equipment) setGlowing(boolean glowing) setGlowingColor(net.kyori.adventure.text.format.NamedTextColor glowingColor) setInteractionCooldown(float interactionCooldown) setLocation(org.bukkit.Location location) setMirrorSkin(boolean mirrorSkin) setOnClick(Consumer<org.bukkit.entity.Player> onClick) setScale(float scale) setShowInTab(boolean showInTab) Loads the skin data and sets it as the skin of the npcsetSkin(String skin, SkinData.SkinVariant variant) Loads the skin data and sets it as the skin of the npcsetSkinData(SkinData skinData) Sets the skin data of the npc Use this method, if you have a loaded skin data object (with texture and signature), otherwise usesetSkin(String, SkinData.SkinVariant)setSpawnEntity(boolean spawnEntity) setTurnToPlayer(boolean turnToPlayer) setTurnToPlayerDistance(int distance) Sets the turn-to-player distance for this NPC.setType(org.bukkit.entity.EntityType type) setVisibility(NpcVisibility visibility) setVisibilityDistance(int visibilityDistance)
-
Constructor Details
-
NpcData
public NpcData(String id, String name, UUID creator, String displayName, SkinData skin, org.bukkit.Location location, boolean showInTab, boolean spawnEntity, boolean collidable, boolean glowing, net.kyori.adventure.text.format.NamedTextColor glowingColor, org.bukkit.entity.EntityType type, Map<NpcEquipmentSlot, org.bukkit.inventory.ItemStack> equipment, boolean turnToPlayer, int turnToPlayerDistance, Consumer<org.bukkit.entity.Player> onClick, Map<ActionTrigger, List<NpcAction.NpcActionData>> actions, float interactionCooldown, float scale, int visibilityDistance, Map<NpcAttribute, String> attributes, boolean mirrorSkin) -
NpcData
-
-
Method Details
-
getId
-
getName
-
getCreator
-
getDisplayName
-
setDisplayName
-
getSkinData
-
setSkinData
Sets the skin data of the npc Use this method, if you have a loaded skin data object (with texture and signature), otherwise usesetSkin(String, SkinData.SkinVariant)- Parameters:
skinData- the skin data
-
setSkin
Loads the skin data and sets it as the skin of the npc- Parameters:
skin- a valid UUID, username, URL or file pathvariant- the skin variant
-
setSkin
-
getLocation
public org.bukkit.Location getLocation() -
setLocation
-
isShowInTab
public boolean isShowInTab() -
setShowInTab
-
isSpawnEntity
public boolean isSpawnEntity() -
setSpawnEntity
-
isCollidable
public boolean isCollidable() -
setCollidable
-
isGlowing
public boolean isGlowing() -
setGlowing
-
getGlowingColor
public net.kyori.adventure.text.format.NamedTextColor getGlowingColor() -
setGlowingColor
-
getType
public org.bukkit.entity.EntityType getType() -
setType
-
getEquipment
-
setEquipment
-
addEquipment
-
getOnClick
-
setOnClick
-
getActions
-
setActions
-
getActions
-
setActions
-
addAction
-
removeAction
-
isTurnToPlayer
public boolean isTurnToPlayer() -
setTurnToPlayer
-
getTurnToPlayerDistance
public int getTurnToPlayerDistance()Gets the turn-to-player distance for this NPC.- Returns:
- the custom distance value, or -1 if using the default from config
-
setTurnToPlayerDistance
Sets the turn-to-player distance for this NPC.- Parameters:
distance- the custom distance value, or -1 to use the default from config- Returns:
- this NpcData instance for method chaining
-
getInteractionCooldown
public float getInteractionCooldown() -
setInteractionCooldown
-
getScale
public float getScale() -
setScale
-
getVisibilityDistance
public int getVisibilityDistance() -
setVisibilityDistance
-
getAttributes
-
addAttribute
-
clearAttributes
public void clearAttributes() -
applyAllAttributes
-
isMirrorSkin
public boolean isMirrorSkin() -
setMirrorSkin
-
getVisibility
-
setVisibility
-
isDirty
public boolean isDirty() -
setDirty
public void setDirty(boolean dirty)
-