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)

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 recipient.

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

Gets the player to reply to. First checks if someone has messaged this player, otherwise falls back to the last person they messaged.

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

Records a 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. Handles formatting and recording the conversation. Applies romaji-to-Japanese conversion if sender has it enabled.