class Rosegold::Serverbound::ChatMessage

Included Modules

Defined in:

rosegold/packets/serverbound/chat_message.cr

Constant Summary

PROTOCOL_PACKET_IDS = {772_u32 => 8_u8}

Store the protocol mappings as a constant

Constructors

Class Method Summary

Instance Method Summary

Macros inherited from module Rosegold::Packets::ProtocolMapping

packet_ids(mappings) packet_ids

Class methods inherited from class Rosegold::Serverbound::Packet

new_raw(bytes) new_raw, state state

Instance methods inherited from class Rosegold::Packet

callback(client_or_server) callback, to_s(io) to_s, write : Bytes write

Constructor Detail

def self.new(message : String, timestamp : Int64 = Time.utc.to_unix_ms, salt : Int64 = Random.new.rand(Int64::MIN..Int64::MAX), signature : Bytes | Nil = nil, message_count : UInt32 = 0_u32, acknowledged : Bytes = Bytes.new(3, 0), checksum : UInt8 = 0_u8) #

[View source]

Class Method Detail

def self.[](protocol_version : UInt32) : UInt8 #

Generate the method for elegant access


[View source]
def self.default_packet_id : UInt8 #

Define default packet ID (typically the latest/most common version)


[View source]
def self.packet_id : UInt8 #

Provide backward compatibility with existing packet_id class getter Use the first protocol's packet ID for registration compatibility


def self.packet_id_for_protocol(protocol_version : UInt32) : UInt8 #

Get packet ID for specific protocol version


[View source]
def self.read(io) #

[View source]
def self.supported_protocols : Array(UInt32) #

Helper method to get all supported protocols


[View source]
def self.supports_protocol?(protocol_version : UInt32) : Bool #

Helper method to check if a protocol is supported


[View source]
def self.unsigned(message : String) #

Convenience method for creating simple unsigned chat messages


[View source]

Instance Method Detail

def acknowledged : Bytes #

[View source]
def acknowledged=(acknowledged : Bytes) #

[View source]
def checksum : UInt8 #

[View source]
def checksum=(checksum : UInt8) #

[View source]
def message : String #

[View source]
def message=(message : String) #

[View source]
def message_count : UInt32 #

[View source]
def message_count=(message_count : UInt32) #

[View source]
def salt : Int64 #

[View source]
def salt=(salt : Int64) #

[View source]
def signature : Bytes | Nil #

[View source]
def signature=(signature : Bytes | Nil) #

[View source]
def timestamp : Int64 #

[View source]
def timestamp=(timestamp : Int64) #

[View source]
def write : Bytes #

[View source]