glowstone 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -33,7 +33,7 @@ my_server = Glowstone::Server.new "tomheinan.com"
33
33
  ... and Glowstone will whip you up a server object full of all that delicious realtime data you've been craving:
34
34
 
35
35
  ```ruby
36
- => #<Glowstone::Server:0x007f9af2d17768 @host="minecraft.tomheinan.com", @port=25565, @timeout=10, @socket=#<UDPSocket:fd 7>, @motd="Welcome to Arkenfall!", @gamemode="SMP", @version="1.4.7", @plugins=["ThirdRail 1.0.0", "Vault 1.2.22-b277", "AdminCmd 7.2.0 (BUILD 22.01.2013 @ 22:13:34)", "WorldEdit 5.5.1", "TreeAssist 5.0", "WorldGuard 747-e3dfc6a", "PlayerMarkers 0.2.0", "PermissionsBukkit 2.0", "SimpleSpleef 3.4.2"], @map_name="arkenfall", @num_players=1, @max_players=16, @players=["tomheinan"]>
36
+ => #<Glowstone::Server:0x007f9af2d17768 @name="tomheinan.com", @host="minecraft.tomheinan.com", @port=25565, @timeout=10, @socket=#<UDPSocket:fd 7>, @motd="Welcome to Arkenfall!", @gamemode="SMP", @version="1.4.7", @plugins=["ThirdRail 1.0.0", "Vault 1.2.22-b277", "AdminCmd 7.2.0 (BUILD 22.01.2013 @ 22:13:34)", "WorldEdit 5.5.1", "TreeAssist 5.0", "WorldGuard 747-e3dfc6a", "PlayerMarkers 0.2.0", "PermissionsBukkit 2.0", "SimpleSpleef 3.4.2"], @map_name="arkenfall", @num_players=1, @max_players=16, @players=["tomheinan"]>
37
37
  ```
38
38
 
39
39
  And that's all there is to it! No fancy bukkit plugins or server-side scripts required. If your server object is particularly long-lived and you find yourself wanting to refresh its data, just do `my_server.refresh` and it'll pull down the latest information for you.
@@ -42,6 +42,7 @@ And that's all there is to it! No fancy bukkit plugins or server-side scripts r
42
42
 
43
43
  ```ruby
44
44
  Glowstone::Server.new("localhost",
45
+ :name => "#{the hostname above}", # you can put any arbitrary string here
45
46
  :port => 25565,
46
47
  :timeout => 5 # seconds before we give up on the socket connection
47
48
  )
@@ -6,7 +6,7 @@ module Glowstone
6
6
  class Server
7
7
 
8
8
  attr_reader :host, :port
9
- attr_accessor :timeout
9
+ attr_accessor :name, :timeout
10
10
  attr_reader :motd, :gamemode, :version, :plugins, :map_name, :num_players, :max_players, :players
11
11
 
12
12
  def initialize(host="localhost", options={})
@@ -16,6 +16,9 @@ module Glowstone
16
16
  options = {:port => options.to_i}
17
17
  end
18
18
 
19
+ # set server name
20
+ @name = options[:name] ? options[:name].to_s : host
21
+
19
22
  # if the host is a srv record, get its info
20
23
  begin
21
24
  resource = Resolv::DNS.new.getresource("_minecraft._tcp.#{host}", Resolv::DNS::Resource::IN::SRV)
@@ -1,3 +1,3 @@
1
1
  module Glowstone
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glowstone
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-27 00:00:00.000000000 Z
12
+ date: 2013-03-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bindata