Fix ugly rubocop if and silent disconnect
This commit is contained in:
parent
ddef46991b
commit
940cc4269f
|
@ -79,7 +79,7 @@ class GameClient
|
||||||
chunk:,
|
chunk:,
|
||||||
client_id:,
|
client_id:,
|
||||||
reason: reason == '' ? nil : reason,
|
reason: reason == '' ? nil : reason,
|
||||||
silent:
|
silent: silent != 0
|
||||||
)
|
)
|
||||||
if @client.hooks[:client_drop]
|
if @client.hooks[:client_drop]
|
||||||
@client.hooks[:client_drop].call(context)
|
@client.hooks[:client_drop].call(context)
|
||||||
|
|
|
@ -83,11 +83,7 @@ class Unpacker
|
||||||
str = ''
|
str = ''
|
||||||
@data.each_with_index do |byte, index|
|
@data.each_with_index do |byte, index|
|
||||||
if byte == 0x00
|
if byte == 0x00
|
||||||
@data = if index == @data.length - 1
|
@data = index == @data.length - 1 ? nil : @data[(index + 1)..]
|
||||||
nil
|
|
||||||
else
|
|
||||||
@data[(index + 1)..]
|
|
||||||
end
|
|
||||||
return str
|
return str
|
||||||
end
|
end
|
||||||
str += byte.chr
|
str += byte.chr
|
||||||
|
|
|
@ -32,7 +32,7 @@ client.on_chat do |msg|
|
||||||
end
|
end
|
||||||
|
|
||||||
client.on_client_info do |ctx|
|
client.on_client_info do |ctx|
|
||||||
puts "'#{ctx.data[:player].name}' joined the game#{reason}"
|
puts "'#{ctx.data[:player].name}' joined the game"
|
||||||
end
|
end
|
||||||
|
|
||||||
client.on_client_drop do |ctx|
|
client.on_client_drop do |ctx|
|
||||||
|
|
Loading…
Reference in a new issue