Package net.citizensnpcs.api.ai.speech
Class SpeechContext
java.lang.Object
net.citizensnpcs.api.ai.speech.SpeechContext
SpeechContext contains information about a
NPCSpeechEvent
, including the Talkable
talker, recipients,
and message.-
Constructor Summary
ConstructorDescriptionSpeechContext
(String message) SpeechContext
(String message, Entity recipient) SpeechContext
(NPC talker, String message) SpeechContext
(NPC talker, String message, Entity recipient) -
Method Summary
Modifier and TypeMethodDescriptionaddRecipient
(Entity entity) Adds a directTalkable
recipient.addRecipients
(List<Talkable> talkables) Adds a list ofTalkable
recipients.Gets the text message sent.Gets the talker.boolean
Checks if there are any recipients.iterator()
Gets direct recipients, if any.void
setMessage
(String message) Sets the text message sent.void
Sets the talker.int
size()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
SpeechContext
public SpeechContext() -
SpeechContext
-
SpeechContext
-
SpeechContext
-
SpeechContext
-
-
Method Details
-
addRecipient
Adds a directTalkable
recipient.- Parameters:
entity
- Talkable entity- Returns:
- the speech context
-
addRecipients
Adds a list ofTalkable
recipients.- Parameters:
talkables
- Talkable entities- Returns:
- the Tongue
-
getMessage
Gets the text message sent. -
getTalker
Gets the talker.- Returns:
- NPC doing the talking
-
hasRecipients
public boolean hasRecipients()Checks if there are any recipients. If none, thisSpeechContext
is not targeted.- Returns:
- true if recipients are specified.
-
iterator
Gets direct recipients, if any. -
setMessage
Sets the text message sent. Overrides text set with the constructor.- Parameters:
message
- The text to send.
-
setTalker
Sets the talker.- Parameters:
entity
- NPC doing the talking
-
size
public int size()- Returns:
- number of recipients.
-