How do I like this?
Sorry for grammar, not good at speaking Portuguese.
Thank you
Sorry for grammar, not good at speaking Portuguese.
Thank you
def handle_chat_message(client, buffer)
message = buffer.read_string
talk_type = buffer.read_byte
name = buffer.read_string
return if message.strip.empty?
return if client.spawning?
return if client.muted?
client.antispam_time = Time.now + 0.5
if message == '/who'
whos_online(client)
return
elsif message.start_with?('/')
if client.admin?
admin_commands(client, message)
return
elsif client.moderator?
moderator_commands(client, message)
return
end
end
prefix = client.admin? ? '[Admin]' : client.moderator? ? '[Mod]' : ''
message = "#{prefix} #{client.name}: #{chat_filter(message)}"
case talk_type
when Constants::CHAT_MAP
map_message(client.map_id, message, client.id)
when Constants::CHAT_GLOBAL
global_message(message)
when Constants::CHAT_PARTY
party_message(client, message)
when Constants::CHAT_PRIVATE
private_message(client, message, name)
end
end
prefix = client.admin? ? '[Admin]' : client.moderator? ? '[Mod]' : ''
message = "#{prefix} #{client.name}: #{chat_filter(message)}"