Class: Minecraft::Runtime
- Inherits:
-
Object
- Object
- Minecraft::Runtime
- Defined in:
- lib/minecraft/runtime.rb
Overview
An instance of the Runtime class will spool up the server and do any preliminary work.
Instance Method Summary collapse
-
#initialize(opts) ⇒ Runtime
constructor
New Runtime instance.
-
#pre_checks ⇒ Object
Checks if Minecraft needs to be updated, checks if mobs are to be toggled.
Constructor Details
#initialize(opts) ⇒ Runtime
New Runtime instance.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/minecraft/runtime.rb', line 13 def initialize(opts) @opts = opts pre_checks Minecraft::Tools.check_jarfile unless @opts[:no_run] command = Minecraft::Tools.command(@opts) puts "[+] #{command}" server = Minecraft::Server.new(command, @opts) server.sin.puts("save-on") unless @opts[:no_auto_save] end end |
Instance Method Details
#pre_checks ⇒ Object
Checks if Minecraft needs to be updated, checks if mobs are to be toggled.
28 29 30 31 |
# File 'lib/minecraft/runtime.rb', line 28 def pre_checks Minecraft::Tools.download_minecraft if @opts[:update] puts "[+] Temporarily toggling mobs. Setting to #{Minecraft::Tools.toggle_mobs}." if @opts[:tempmobs] end |