Module: MCLib

Defined in:
lib/mclib.rb,
lib/mclib/version.rb

Defined Under Namespace

Classes: EventFactory, LogParser, Watcher

Constant Summary collapse

VERSION =
'0.0.2'
@@mc_dir =
''

Class Method Summary collapse

Class Method Details

.banned_ipsObject



28
29
30
# File 'lib/mclib.rb', line 28

def self.banned_ips
  JSON.parse(File.open(@@mc_dir + 'banned-ips.json').read)
end

.banned_playersObject



32
33
34
# File 'lib/mclib.rb', line 32

def self.banned_players
  JSON.parse(File.open(@@mc_dir + 'banned-players.json').read)
end

.get_mc_dirObject



14
15
16
# File 'lib/mclib.rb', line 14

def self.get_mc_dir
  @@mc_dir
end

.opsObject



18
19
20
21
# File 'lib/mclib.rb', line 18

def self.ops
  json = JSON.parse(File.open(@@mc_dir + 'ops.json').read)
  json.collect { |user| user['name'] }
end

.set_mc_dir(dir) ⇒ Object



9
10
11
12
# File 'lib/mclib.rb', line 9

def self.set_mc_dir(dir)
  dir.chomp! '/' # in case of trailing slash
  @@mc_dir = dir
end

.whitelistObject



23
24
25
26
# File 'lib/mclib.rb', line 23

def self.whitelist
  json = JSON.parse(File.open(@@mc_dir + 'whitelist.json').read)
  json.collect { |user| user['name'] }
end