Package net.citizensnpcs.trait.text
Class Text
java.lang.Object
net.citizensnpcs.api.trait.Trait
net.citizensnpcs.trait.text.Text
Persists text metadata, i.e. text that will be said by an NPC on certain triggers.
- 
Field Summary
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdds a piece of text that will be said by the NPC.voidEdit the text at a given index to a new text.Builds a text editor in game for the suppliedPlayer.getTexts()booleanhasIndex(int index) booleanvoidLoads a trait.voidonSpawn()Called when anNPCis spawned.voidremove(int index) Remove text at a given index.voidrun()Called every tick if overridden.voidSaves a trait.booleanvoidsetDelay(int delay) Set the text delay between messages.voidsetItemInHandPattern(String pattern) Sets the item in hand pattern required to talk to NPCs, if enabled.voidsetRange(double range) Set the range in blocks before text will be sent.voidsetSpeechBubbleDuration(Duration duration) booleanbooleanToggles talking at random intervals.booleanToggles requiring line of sight before talking.booleanToggles sending text through chatbooleanToggles using speech bubbles instead of messages.booleanToggles talking to nearby Players.booleanboolean
- 
Constructor Details- 
Textpublic Text()
 
- 
- 
Method Details- 
addAdds a piece of text that will be said by the NPC.- Parameters:
- string- the text to say
 
- 
editEdit the text at a given index to a new text.- Parameters:
- index- the text's index
- newText- the new text to use
 
- 
getEditorBuilds a text editor in game for the suppliedPlayer.
- 
getTexts- Returns:
- The list of all texts
 
- 
hasIndexpublic boolean hasIndex(int index) - Returns:
- whether there is text at a certain index
 
- 
isRandomTalkerpublic boolean isRandomTalker()
- 
loadDescription copied from class:TraitLoads a trait.
- 
onSpawnpublic void onSpawn()Description copied from class:TraitCalled when anNPCis spawned.NPC.getEntity()will return null until this is called. This is also called onAttach when the NPC is already spawned.
- 
removepublic void remove(int index) Remove text at a given index.
- 
runpublic void run()Description copied from class:TraitCalled every tick if overridden.
- 
saveDescription copied from class:TraitSaves a trait.
- 
sendTextToChatpublic boolean sendTextToChat()
- 
setDelaypublic void setDelay(int delay) Set the text delay between messages.- Parameters:
- delay- the delay in ticks
 
- 
setItemInHandPatternSets the item in hand pattern required to talk to NPCs, if enabled.- Parameters:
- pattern- The new pattern
 
- 
setRangepublic void setRange(double range) Set the range in blocks before text will be sent.- Parameters:
- range-
 
- 
setSpeechBubbleDuration
- 
shouldTalkClosepublic boolean shouldTalkClose()- Returns:
- Whether talking close is enabled.
 
- 
toggleRandomTalkerpublic boolean toggleRandomTalker()Toggles talking at random intervals.
- 
toggleRealisticLookingpublic boolean toggleRealisticLooking()Toggles requiring line of sight before talking.
- 
toggleSendTextToChatpublic boolean toggleSendTextToChat()Toggles sending text through chat
- 
toggleSpeechBubblespublic boolean toggleSpeechBubbles()Toggles using speech bubbles instead of messages.
- 
toggleTalkClosepublic boolean toggleTalkClose()Toggles talking to nearby Players.
- 
useRealisticLookingpublic boolean useRealisticLooking()
- 
useSpeechBubblespublic boolean useSpeechBubbles()
 
-