Class: MinecraftSpigot

Inherits:
Object
  • Object
show all
Defined in:
lib/game_servers/minecraft_spigot.rb

Overview

A class for Feed The Beast Minecraft Server

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMinecraftSpigot

Returns a new instance of MinecraftSpigot.



7
8
9
10
# File 'lib/game_servers/minecraft_spigot.rb', line 7

def initialize
  @name = "minecraft"
  @app_id = nil
end

Instance Attribute Details

#app_idObject (readonly)

Returns the value of attribute app_id.



6
7
8
# File 'lib/game_servers/minecraft_spigot.rb', line 6

def app_id
  @app_id
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/game_servers/minecraft_spigot.rb', line 6

def name
  @name
end

Instance Method Details

#install_server(install_path, version = "1.13.2") ⇒ Object



16
17
18
19
20
21
22
# File 'lib/game_servers/minecraft_spigot.rb', line 16

def install_server(install_path, version = "1.13.2")
  FileUtils.mkdir_p(install_path)
  File.open("#{install_path}/BuildTools.jar", "wb") do |file|
    file.write(open("https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar").read())
  end
  system("cd #{install_path} && java -jar #{install_path}/BuildTools.jar --rev #{version}")
end

#launch(install_path, version = "1.13.2") ⇒ Object



12
13
14
# File 'lib/game_servers/minecraft_spigot.rb', line 12

def launch(install_path, version = "1.13.2")
  "cd #{install_path} && java -Xms1G -Xmx2G -jar spigot-#{version}.jar --noconsole"
end