minecraft 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +24 -4
- data/lib/minecraft.rb +1 -0
- data/lib/minecraft/data.rb +2 -2
- data/lib/minecraft/extensions.rb +15 -4
- data/lib/minecraft/tools.rb +1 -0
- data/lib/minecraft/version.rb +1 -1
- data/test/commands_test.rb +0 -5
- metadata +2 -2
data/README.md
CHANGED
@@ -98,11 +98,10 @@ Development Path
|
|
98
98
|
### Semantic Versioning
|
99
99
|
|
100
100
|
- http://semver.org
|
101
|
-
- Currently patch level releases are being made, nothing is stable
|
102
|
-
|
103
|
-
committed.
|
101
|
+
- Currently minor and patch level releases are being made, nothing is stable
|
102
|
+
yet.
|
104
103
|
- Once the repository is completely stable and I am satisified with the feature
|
105
|
-
set, a major version will be released. Any
|
104
|
+
set, a major version will be released. Any changes afterwards are backwards
|
106
105
|
compatible until the major version is incremented.
|
107
106
|
|
108
107
|
Contributors
|
@@ -112,6 +111,27 @@ Forks are welcomed, pull requests will be prompty reviewed!
|
|
112
111
|
|
113
112
|
- Ian Horsman
|
114
113
|
|
114
|
+
Pull Request Guide
|
115
|
+
------------------
|
116
|
+
|
117
|
+
Pull requests are currently being accepted, please make sure that you fork off
|
118
|
+
of the `development` branch, preferably then developing on a feature branch.
|
119
|
+
|
120
|
+
Make sure your code includes tests and follow similar methodologies used in the
|
121
|
+
the code base, make sure to read relevant chunks of the code base before
|
122
|
+
committing. Pull requests will be merged very strictly.
|
123
|
+
|
124
|
+
Read [https://github.com/basicxman/minecraft/wiki/Writing-tests](here) for how
|
125
|
+
we develop code with test driven development.
|
126
|
+
|
127
|
+
For any non-straightforward functionality (especially command naming and
|
128
|
+
syntax) you are encouraged to open up an
|
129
|
+
[http://github.com/basicxman/minecraft/issues](issue) for discussion, issues
|
130
|
+
will be read and commented on promptly. Remember to report any bugs as well,
|
131
|
+
a bug can be something as simple as a command not returning feedback to the
|
132
|
+
user.
|
133
|
+
|
134
|
+
|
115
135
|
Notice
|
116
136
|
------
|
117
137
|
|
data/lib/minecraft.rb
CHANGED
data/lib/minecraft/data.rb
CHANGED
@@ -30,11 +30,11 @@ module Minecraft
|
|
30
30
|
|
31
31
|
# Quotes for each time of day.
|
32
32
|
TIME_QUOTES = {
|
33
|
-
:morning => "
|
33
|
+
:morning => "",
|
34
34
|
:evening => "Let them come.",
|
35
35
|
:day => "",
|
36
36
|
:night => "",
|
37
|
-
:dawn => "
|
37
|
+
:dawn => "",
|
38
38
|
:dusk => ""
|
39
39
|
}
|
40
40
|
|
data/lib/minecraft/extensions.rb
CHANGED
@@ -11,7 +11,7 @@ module Minecraft
|
|
11
11
|
# @param [IO] server The standard input pipe of the server process.
|
12
12
|
# @param [Slop] opts Command line options from Slop.
|
13
13
|
def initialize(server, opts)
|
14
|
-
@ops = File.readlines("ops.txt").map { |s| s.chomp }
|
14
|
+
@ops = File.readlines("ops.txt").map { |s| s.chomp } if File.exists? "ops.txt"
|
15
15
|
get_json :hops, []
|
16
16
|
get_json :uptime
|
17
17
|
get_json :timers
|
@@ -29,6 +29,8 @@ module Minecraft
|
|
29
29
|
@last_kick_vote = nil
|
30
30
|
load_server_properties
|
31
31
|
|
32
|
+
@ic = Iconv.new("UTF-8//IGNORE", "UTF-8")
|
33
|
+
|
32
34
|
opts.to_hash.each { |k, v| instance_variable_set("@#{k}", v) }
|
33
35
|
@vote_expiration ||= 300
|
34
36
|
@vote_threshold ||= 5
|
@@ -203,6 +205,7 @@ module Minecraft
|
|
203
205
|
|
204
206
|
# Processes a line from the console.
|
205
207
|
def process(line)
|
208
|
+
line = @ic.iconv(line) if line.index "7"
|
206
209
|
puts colour(line.dup)
|
207
210
|
return info_command(line) if line.index "INFO"
|
208
211
|
rescue Exception => e
|
@@ -405,10 +408,18 @@ module Minecraft
|
|
405
408
|
# @example
|
406
409
|
# say("The quick brown fox jumped over the lazy dog.")
|
407
410
|
def say(message)
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
+
temp_length, buf = 0, []
|
412
|
+
message.split(" ").each do |word|
|
413
|
+
temp_length += word.length
|
414
|
+
if temp_length > 45
|
415
|
+
@server.puts "say #{buf.join(" ")}"
|
416
|
+
buf = [word]
|
417
|
+
temp_length = word.length
|
418
|
+
else
|
419
|
+
buf << word
|
420
|
+
end
|
411
421
|
end
|
422
|
+
@server.puts "say #{buf.join(" ")}" unless buf.empty?
|
412
423
|
end
|
413
424
|
|
414
425
|
# Check if a user has op privileges.
|
data/lib/minecraft/tools.rb
CHANGED
@@ -31,6 +31,7 @@ module Minecraft
|
|
31
31
|
|
32
32
|
# Toggles mobs in server.properties and returns the new state.
|
33
33
|
def self.toggle_mobs
|
34
|
+
return unless File.exists? "server.properties"
|
34
35
|
content = File.read("server.properties")
|
35
36
|
state = content.match(/spawn\-monsters=(true|false)/)[1]
|
36
37
|
new_state = state == "true" ? "false" : "true"
|
data/lib/minecraft/version.rb
CHANGED
data/test/commands_test.rb
CHANGED
@@ -264,11 +264,6 @@ eof
|
|
264
264
|
@ext = Minecraft::Extensions.new(StringIO.new, {})
|
265
265
|
@ext.ops = ["basicxman"]
|
266
266
|
|
267
|
-
# None
|
268
|
-
@ext.call_command("basicxman", "help", "day")
|
269
|
-
t = @ext.server.string.split("\n")
|
270
|
-
assert_equal "say !day", t[0]
|
271
|
-
|
272
267
|
# opt
|
273
268
|
@ext.server.string = ""
|
274
269
|
@ext.call_command("basicxman", "help", "warptime")
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: minecraft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.3.
|
5
|
+
version: 0.3.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Andrew Horsman
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-08-
|
13
|
+
date: 2011-08-30 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|