Class: MinecraftServerCheck

Inherits:
GaddyGaddyCheck show all
Defined in:
lib/gg_check/plugins/MinecraftServer.rb

Instance Method Summary collapse

Methods inherited from GaddyGaddyCheck

#extra, #initialize, #process_alive?, #run_cmd, #socket

Constructor Details

This class inherits a constructor from GaddyGaddyCheck

Instance Method Details

#status(options) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/gg_check/plugins/MinecraftServer.rb', line 16

def status(options)
  check_result = {}
  # Send \xfe command to see if server is ready
  result = socket '127.0.0.1', 25565, "\xfe", 3
  if result[0].ord == 255
    check_result['status'] = 0
  else
    check_result['status'] = 2
    check_result['message_key'] = 'event.not_running'
  end
  check_result
end