Fix ugly rubocop if and silent disconnect

This commit is contained in:
ChillerDragon 2022-11-05 17:23:35 +01:00
parent ddef46991b
commit 940cc4269f
3 changed files with 3 additions and 7 deletions

View file

@ -79,7 +79,7 @@ class GameClient
chunk:,
client_id:,
reason: reason == '' ? nil : reason,
silent:
silent: silent != 0
)
if @client.hooks[:client_drop]
@client.hooks[:client_drop].call(context)

View file

@ -83,11 +83,7 @@ class Unpacker
str = ''
@data.each_with_index do |byte, index|
if byte == 0x00
@data = if index == @data.length - 1
nil
else
@data[(index + 1)..]
end
@data = index == @data.length - 1 ? nil : @data[(index + 1)..]
return str
end
str += byte.chr

View file

@ -32,7 +32,7 @@ client.on_chat do |msg|
end
client.on_client_info do |ctx|
puts "'#{ctx.data[:player].name}' joined the game#{reason}"
puts "'#{ctx.data[:player].name}' joined the game"
end
client.on_client_drop do |ctx|