minecraft 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
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 yet.
102
- - Once tests and documentation has been written a stable minor release will be
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 chances afterwards are backwards
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
 
@@ -1,3 +1,4 @@
1
+ require "iconv"
1
2
  require "json/pure"
2
3
  require "minecraft/tools"
3
4
  require "minecraft/data"
@@ -30,11 +30,11 @@ module Minecraft
30
30
 
31
31
  # Quotes for each time of day.
32
32
  TIME_QUOTES = {
33
- :morning => "Anyone like a little toasted zombie?",
33
+ :morning => "",
34
34
  :evening => "Let them come.",
35
35
  :day => "",
36
36
  :night => "",
37
- :dawn => "What are you doing? Those wraiths are still out there.",
37
+ :dawn => "",
38
38
  :dusk => ""
39
39
  }
40
40
 
@@ -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
- (message.length / 50.0).ceil.times do |n|
409
- temp = message[(50 * n), 50]
410
- @server.puts "say #{temp}"
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.
@@ -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"
@@ -1,5 +1,5 @@
1
1
  # Global Minecraft module.
2
2
  module Minecraft
3
3
  # Yay, keep these versions coming!
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
@@ -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.0
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-29 00:00:00 -04:00
13
+ date: 2011-08-30 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency