Skip to content

Commit

Permalink
Fix admin leave message never being used
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe-Klauza committed May 2, 2023
1 parent 5e14da5 commit 81bafb0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions admin-interface/lib/server-monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,11 @@ def process_rcon_players(rcon_players, prev_rcon_players)
players_gone.each do |player|
if @daemon_handle
is_admin = @daemon_handle.is_sandstorm_admin?(player['steam_id'])
message_option = is_admin ? 'admin_leave_message' : 'leave_message'
log "Player left: #{player['name']} (#{player['steam_id']})#{' (admin)' if is_admin}", level: :info
unless @daemon_handle.config['leave_message'].empty?
unless @daemon_handle.config[message_option].empty?
Thread.new do
message = @daemon_handle.config['leave_message'].gsub('${player_name}', player.dig('steam_info', 'name') || player['name']).gsub('${player_id}', player['steam_id'] || 'NULL')
message = @daemon_handle.config[message_option].gsub('${player_name}', player.dig('steam_info', 'name') || player['name']).gsub('${player_id}', player['steam_id'] || 'NULL')
@rcon_client.send(@ip, @rcon_port, @rcon_pass, "say #{message}")
end
end
Expand Down

0 comments on commit 81bafb0

Please sign in to comment.