DirectMessageHandler

class DirectMessageHandler(configuration: LunaticChatConfiguration, settingsManager: PlayerSettingsManager?, romanjiConverter: RomanjiConverter?, languageManager: LanguageManager)(source)

Manages direct message state including reply targets. Tracks the last player who messaged each player for /reply functionality.

Constructors

Link copied to clipboard
constructor(configuration: LunaticChatConfiguration, settingsManager: PlayerSettingsManager?, romanjiConverter: RomanjiConverter?, languageManager: LanguageManager)

Properties

Link copied to clipboard

Registry of proxy-wide player presence. Set when cross-server direct messages are enabled; used to validate ReplyTarget.Remote reply targets.

Functions

Link copied to clipboard
fun clearPlayer(player: Player)

Clears message history for a player (called on disconnect). Removes entries where this player is either the sender or a local target.

Link copied to clipboard
fun getReplyTarget(player: Player): ReplyTarget?

Gets the target to reply to. First checks if someone has messaged this player, otherwise falls back to the last person they messaged. Targets that are no longer reachable (offline locally, or absent from the proxy roster) are skipped.

Link copied to clipboard
fun handleIncomingCrossServerMessage(recipient: Player, senderName: String, sourceServerName: String, message: String)

Handles the receiver-side display of an incoming cross-server direct message. The message body is already romaji-converted by the sending server.

Link copied to clipboard
fun handleOutgoingCrossServerMessage(sender: Player, targetName: String, targetServerName: String, message: String): String

Handles the sender-side display of an outgoing cross-server direct message. Applies romaji conversion, shows the message to the sender, notifies spies, and records the remote reply target.

Link copied to clipboard
fun recordMessage(sender: Player, recipient: Player)

Records a local direct message between two players. Updates both the sender's last recipient and the receiver's last messager.

Link copied to clipboard
fun sendDirectMessage(sender: Player, recipient: Player, message: String): Boolean

Sends a direct message from one player to another on the same server. Handles formatting and recording the conversation. Applies romaji-to-Japanese conversion if sender has it enabled.