Class: MinecraftSpigot
- Inherits:
-
Object
- Object
- MinecraftSpigot
- Defined in:
- lib/servers/minecraft_spigot.rb
Overview
A class for Feed The Beast Minecraft Server
Instance Attribute Summary collapse
-
#app_id ⇒ Object
readonly
Returns the value of attribute app_id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize ⇒ MinecraftSpigot
constructor
A new instance of MinecraftSpigot.
- #install_server(install_path, version = "1.14") ⇒ Object
- #launch(install_path, version = "1.14") ⇒ Object
Constructor Details
#initialize ⇒ MinecraftSpigot
Returns a new instance of MinecraftSpigot.
9 10 11 12 |
# File 'lib/servers/minecraft_spigot.rb', line 9 def initialize @name = "minecraft" @app_id = nil end |
Instance Attribute Details
#app_id ⇒ Object (readonly)
Returns the value of attribute app_id.
8 9 10 |
# File 'lib/servers/minecraft_spigot.rb', line 8 def app_id @app_id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/servers/minecraft_spigot.rb', line 8 def name @name end |
Instance Method Details
#install_server(install_path, version = "1.14") ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/servers/minecraft_spigot.rb', line 18 def install_server(install_path, version = "1.14") 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.14") ⇒ Object
14 15 16 |
# File 'lib/servers/minecraft_spigot.rb', line 14 def launch(install_path, version = "1.14") "cd #{install_path} && java -Xms1G -Xmx2G -jar spigot-#{version}.jar --noconsole" end |