minecraft-server 0.0.1.pre.36 → 0.0.1.pre.38

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWJlNjA0N2Q1ZTNmYzQ5N2MxNzVkMTMzZTEyNzZlYzM0NGYxMGI2NA==
4
+ ZTljNTc3MzA1YTE3MGVlMzM0OThjMTBiMmJkMTI4YjYwMTk0YzhlOA==
5
5
  data.tar.gz: !binary |-
6
- NGE3YjhkODI4ZDM1OWE4ZjQwZTIzM2MwNzcwZWVkZGZjNDhhY2MzNw==
6
+ NjUxZTQyNzE3ZjQzM2QyYWZmZTZhZTY1MDg0MzM5ZGExMmQxODBmZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDllMjBjZTJmYjQ0OTQ4ODZmNmU5YmNkNDU4OTBlYjkyZGRjNDI0OTI5OWJh
10
- M2Q3ODlmZjhkY2YzMzNhZDk3ZTNlMmJjYzU3OWMxNzc4MDE5ODkyNDUyOWNk
11
- NjM1MDQ2MjRiZGYyM2ZhZDE0NDRlMGM1OTkwYmI5ODlhMDI3NWY=
9
+ ZmY4ODk4MzI0MjRmYWM4MDUxNjg1YmM0MTA0YjRmNDZmODdlYTY1N2U2OWMw
10
+ Y2ZkM2UzMGVhMzAyYTVjNjdlNTExM2UwMWMxMTY2MWRhMTZmN2M5ZDhlNjM0
11
+ NmU5Y2U5ODhiZjJmNWFiZDdjOTU2M2IwM2U1ZmJlMjg2MGVkZTI=
12
12
  data.tar.gz: !binary |-
13
- M2RmYjUyM2I5NjI2ODUzOTkyNTJjZTgxMzBmM2UzMzRmM2VmOGNhZTY1MzE4
14
- OWRlNjFiYWI4MmZhNWU3M2Y5MGRiMWM2YTEzZjI1NzZkYjUxNmNjNDIzMDg4
15
- YzYyMzY1ZjUxMDM4NGNjMWEwYTVjNzA2NTYyYzViY2ZmNjk2ZjU=
13
+ Y2YwY2Q4MTBkOGMxNmI2MGNiNWM2NDYxYTllMDA5OTVjOGEwNjdiN2QyYjZl
14
+ YzMyOGVkOWFmMWRlNzVkOWVkOGUxMmYxYTM2YzgyNTk0YWI5OTViNDY0NzVl
15
+ MWM5OGQxOTIzZjZjOWIwOWU1Yjg4ZTU5Nzk0YzkwZTRhZWE1ZTY=
@@ -5,25 +5,6 @@ require 'minecraft/server/version'
5
5
 
6
6
  module Minecraft
7
7
  class Server
8
- # All the booleans representing the APIs the current instance of {Minecraft::Server} is representing.
9
-
10
- # @!attribute bukkit_api
11
- # Instance variable representing whether or not this instance of {Minecraft::Server} is compatible with the
12
- # {Bukkit} API.
13
- # @return [Boolean] Whether or not this instance of {Minecraft::Server} is using the {Bukkit} API.
14
- # @!attribute minecraft_forge_api
15
- # Instance variable representing whether or not this instance of {Minecraft::Server} is compatible with the
16
- # {Minecraft::Forge} API.
17
- # @return [Boolean] Whether or not this instance of {Minecraft::Server} is using the {Minecraft::Forge} API.
18
- # @!attribute spigot_api
19
- # Instance variable representing whether or not this instance of {Minecraft::Server} is compatible with the
20
- # {Spigot} API.
21
- # @return [Boolean] Whether or not this instance of {Minecraft::Server} is using the {Spigot} API.
22
- # @!attribute sponge_api
23
- # Instance variable representing whether or not this instance of {Minecraft::Server} is compatible with the
24
- # {Sponge} API.
25
- # @return [Boolean] Whether or not this instance of {Minecraft::Server} is using the {Sponge} API.
26
- attr_accessor :bukkit_api, :minecraft_forge_api, :spigot_api, :sponge_api
27
8
 
28
9
  # @!attribute server
29
10
  # Instance variable representing the current instance of {TCPServer} this instance of {Minecraft::Server} is
@@ -36,76 +17,66 @@ module Minecraft
36
17
  # @return [Array] The clients connected
37
18
  attr_reader :clients
38
19
 
39
- # @!attribute port
40
- # Instance variable representing the port used for network communication.
41
- # @return [Integer] The port used for network communication
42
- attr_accessor :port
43
-
44
20
  # @!attribute logger
45
21
  # Instance variable representing the Logger being used.
46
22
  # @return [Log4r::Logger]
47
23
  attr_accessor :logger
48
24
 
49
- attr_reader :max_players
25
+ attr_reader :config
50
26
 
51
27
  def initialize(config = {})
52
28
  @logger = Minecraft::Server::Logger.new
29
+ @config = config
30
+
31
+ bukkit_api
32
+ minecraft_forge_api
33
+ spigot_api
34
+ sponge_api
35
+
36
+ logger.info "Running on port: #{config[:port]}"
37
+ end
53
38
 
39
+ def bukkit_api
54
40
  if config[:bukkit]
55
- @bukkit_api = true
56
41
  require 'bukkit/server'
57
42
  self.extend Bukkit::Server
58
43
  logger.info 'Implementing the Bukkit API.'
59
44
  else
60
- @bukkit_api = false
61
45
  logger.info 'Not implementing the Bukkit API.'
62
46
  end
47
+ end
63
48
 
49
+ def minecraft_forge_api
64
50
  if config[:minecraft_forge]
65
- @minecraft_forge_api = true
66
51
  #self.extend Minecraft::Forge::Server
67
52
  logger.info 'Implementing the Minecraft Forge API.'
68
53
  else
69
- @minecraft_forge_api = false
70
54
  logger.info 'Not implementing the Minecraft Forge API.'
71
55
  end
56
+ end
72
57
 
58
+ def spigot_api
73
59
  if config[:spigot]
74
- @spigot_api = true
75
60
  #self.extend Spigot::Server
76
61
  logger.info 'Implementing the Spigot API.'
77
62
  else
78
- @spigot_api = false
79
63
  logger.info 'Not implementing the Spigot API.'
80
64
  end
65
+ end
81
66
 
67
+ def sponge_api
82
68
  if config[:sponge]
83
- @sponge_api = true
84
69
  #self.extend Sponge::Server
85
70
  logger.info 'Implementing the Sponge API.'
86
71
  else
87
- @sponge_api = false
88
72
  logger.info 'Not implementing the Sponge API.'
89
73
  end
90
-
91
- if config[:port]
92
- @port = config[:port]
93
- else
94
- @port = 25565
95
- end
96
- logger.info "Running on port: #{@port}"
97
-
98
- if config[:max_players]
99
- @max_players = config[:max_players]
100
- else
101
- @max_players = 20
102
- end
103
74
  end
104
75
 
105
76
  # Starts this instance of {Minecraft::Server}
106
77
  def start
107
- @server = TCPServer.new(@port)
108
- @clients = Array.new(max_players)
78
+ @server = TCPServer.new(config[:port])
79
+ @clients = Array.new(config[:max_players])
109
80
  logger.info 'Now Accepting Clients.'
110
81
  accept_clients
111
82
  end
@@ -6,29 +6,50 @@ module Minecraft
6
6
 
7
7
  def initialize(file)
8
8
  @config = {}
9
+
10
+ #Call all of the methods to fill the Hash with default values
11
+ bukkit
12
+ minecraft_forge
13
+ spigot
14
+ sponge
15
+ port
16
+ max_players
17
+
9
18
  self.instance_eval(File.read(file), file)
10
19
  end
11
20
 
12
21
  ## APIs being Implemented by the Server
13
22
 
23
+
24
+ # Representation of whether or not this instance of {Minecraft::Server} is compatible with the {Bukkit} API.
25
+ # @return [Boolean] Whether or not this instance of {Minecraft::Server} is using the {Bukkit} API.
14
26
  def bukkit(boolean = false)
15
27
  @config[:bukkit] = boolean
16
28
  end
17
29
 
30
+ # Representation of whether or not this instance of {Minecraft::Server} is compatible with the {Minecraft::Forge}
31
+ # API.
32
+ # @return [Boolean] Whether or not this instance of {Minecraft::Server} is using the {Minecraft::Forge} API.
18
33
  def minecraft_forge(boolean = false)
19
34
  @config[:minecraft_forge] = boolean
20
35
  end
21
36
 
37
+ # Representation of whether or not this instance of {Minecraft::Server} is compatible with the {Spigot} API.
38
+ # @return [Boolean] Whether or not this instance of {Minecraft::Server} is using the {Spigot} API.
22
39
  def spigot(boolean = false)
23
40
  @config[:spigot] = boolean
24
41
  end
25
42
 
43
+ # Representation of whether or not this instance of {Minecraft::Server} is compatible with the {Sponge} API.
44
+ # @return [Boolean] Whether or not this instance of {Minecraft::Server} is using the {Sponge} API.
26
45
  def sponge(boolean = false)
27
46
  @config[:sponge] = boolean
28
47
  end
29
48
 
30
49
  ## Network Settings
31
50
 
51
+ # Representation of the port used for network communication.
52
+ # @return [Integer] The port used for network communication
32
53
  def port(port = 25565)
33
54
  @config[:port] = port
34
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minecraft-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.pre.36
4
+ version: 0.0.1.pre.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kepler Sticka-Jones