API reference / @jsprismarine/prismarine / chat/ChatManager
chat/ChatManager
Classes
Interfaces
ChatDelivery
Defined in: packages/prismarine/src/chat/ChatManager.ts:13
One chat line as a player's client receives it.
Properties
kind
readonlykind:MessageKind
Defined in: packages/prismarine/src/chat/ChatManager.ts:15
message
readonlymessage:string
Defined in: packages/prismarine/src/chat/ChatManager.ts:14
needsTranslation
readonlyneedsTranslation:boolean
Defined in: packages/prismarine/src/chat/ChatManager.ts:17
parameters
readonlyparameters:string[]
Defined in: packages/prismarine/src/chat/ChatManager.ts:16
sender?
readonlyoptionalsender?:ShownChatSender
Defined in: packages/prismarine/src/chat/ChatManager.ts:23
The author's UUID and signature, for a player's own chat only.
sourceName?
readonlyoptionalsourceName?:string
Defined in: packages/prismarine/src/chat/ChatManager.ts:19
The author's name, for a player's own chat only.
xuid?
readonlyoptionalxuid?:string
Defined in: packages/prismarine/src/chat/ChatManager.ts:21
The author's XUID, for a player's own chat only, and empty without one.
ChatRecipient
Defined in: packages/prismarine/src/chat/ChatManager.ts:32
A connected player as the chat fan-out sees one: who they are and where their lines go.
The name and the operator check are read when a message arrives rather than when the player joins, so a name or an operator grant that changes in between is the one that counts.
Properties
key
readonlykey:string
Defined in: packages/prismarine/src/chat/ChatManager.ts:34
The player's key; see keyOfPlayer.
Methods
getName()
getName():
string
Defined in: packages/prismarine/src/chat/ChatManager.ts:36
The name a *.player.<name> channel addresses.
Returns
string
isOp()
isOp():
boolean
Defined in: packages/prismarine/src/chat/ChatManager.ts:38
Whether the *.ops channel reaches this player.
Returns
boolean
receive()
receive(
delivery):Promise<void>
Defined in: packages/prismarine/src/chat/ChatManager.ts:40
Sends one line to the player's client.
Parameters
delivery
Returns
Promise<void>
ChatRecipientServer
Defined in: packages/prismarine/src/chat/ChatManager.ts:50
What a recipient built by chatRecipientOf reads of the server.
Methods
getPermissionManager()
getPermissionManager():
object
Defined in: packages/prismarine/src/chat/ChatManager.ts:52
Returns
object
isOp()
isOp(
subject):boolean
Parameters
subject
Returns
boolean
getSessionManager()
getSessionManager():
ChatSessions
Defined in: packages/prismarine/src/chat/ChatManager.ts:51
Returns
ChatSessions
Defined in: packages/prismarine/src/chat/ChatManager.ts:44
The session registry, as a recipient finds its player's client in it.
Methods
sessionOf()
sessionOf(
id): {sendMessage(delivery):Promise<void>; } |null
Defined in: packages/prismarine/src/chat/ChatManager.ts:46
The client of the online player with this entity id, or null when no online player has it.
Parameters
id
bigint
Returns
{ sendMessage(delivery): Promise<void>; } | null
PlayerChatIntent
Defined in: packages/prismarine/src/chat/ChatManager.ts:82
A line a player typed, as the chat action's guard stage sees it.
Properties
message
readonlymessage:string
Defined in: packages/prismarine/src/chat/ChatManager.ts:85
sender
readonlysender:bigint
Defined in: packages/prismarine/src/chat/ChatManager.ts:84
The entity id of the player who typed it.
Type Aliases
ChatBus
ChatBus =
Pick<ServerEventBus,"post">
Defined in: packages/prismarine/src/chat/ChatManager.ts:79
The part of the server's event bus chat uses.
PlayerChatGuard
PlayerChatGuard = (
intent) => {veto:true; } | {intent:PlayerChatIntent;veto:false; }
Defined in: packages/prismarine/src/chat/ChatManager.ts:92
A guard in the chat action's guard stage (ADR 0013). It reads the line, writes nothing, and lets it through or vetoes it.
Parameters
intent
Returns
{ veto: true; } | { intent: PlayerChatIntent; veto: false; }
Functions
chatRecipientOf()
chatRecipientOf(
player,server):ChatRecipient
Defined in: packages/prismarine/src/chat/ChatManager.ts:68
A connected player as the chat fan-out reaches them, built from who they are.
The key and the name come from the identity and the operator check from the permission list. Each line goes to the session the registry finds under the player's entity id, so the recipient holds neither the player nor its client, and a line for a player who has left reaches nobody.
Parameters
player
The player's entity id and identity, as its session holds them.
identity
The name, XUID and UUID the login named.
runtimeId
bigint
The entity id the registry finds the session by.
server
The session registry and the permission list.
Returns
The recipient, to join once and leave with.