Module: MojangApi

Defined in:
lib/mojang_api.rb,
lib/mojang_api/profile.rb,
lib/mojang_api/version.rb,
lib/mojang_api/whitelist.rb,
lib/mojang_api/whitelist/base.rb,
lib/mojang_api/whitelist/one_six.rb,
lib/mojang_api/whitelist/one_seven.rb

Defined Under Namespace

Modules: Whitelist Classes: Profile

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.get_name_from_uuid(uuid, opts = {}) ⇒ Object



29
30
31
# File 'lib/mojang_api.rb', line 29

def self.get_name_from_uuid(uuid, opts={})
  get_profile_from_uuid(uuid, opts).name
end

.get_profile_from_name(name, opts = {}) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/mojang_api.rb', line 8

def self.get_profile_from_name(name, opts={})
  game = opts.fetch(:game, 'minecraft')
  uuid_time = opts.fetch(:at_time, Time.now)
  
  p = Profile.new name: name, uuid_time: uuid_time, game: game
  p.load_uuid
  p
end

.get_profile_from_uuid(uuid, opts = {}) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/mojang_api.rb', line 21

def self.get_profile_from_uuid(uuid, opts={})
  game = opts.fetch(:game, 'minecraft')
  
  p = Profile.new uuid: uuid, game: game
  p.load_name
  p
end

.get_profiles_from_name_list(name_list) ⇒ Object



33
34
35
# File 'lib/mojang_api.rb', line 33

def self.get_profiles_from_name_list(name_list)
  Profile.load_from_name_list(name_list)
end

.get_uuid_from_name(name, opts = {}) ⇒ Object



17
18
19
# File 'lib/mojang_api.rb', line 17

def self.get_uuid_from_name(name, opts={})
  get_profile_from_name(name, opts).uuid
end