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 = @version) ⇒ Object
- #launch(install_path) ⇒ Object
- #post_install(install_path, version = @version) ⇒ Object
Constructor Details
#initialize ⇒ MinecraftSpigot
Returns a new instance of MinecraftSpigot.
9 10 11 12 13 |
# File 'lib/servers/minecraft_spigot.rb', line 9 def initialize @name = "minecraft" @app_id = nil @version = "1.14.4" 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 = @version) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/servers/minecraft_spigot.rb', line 19 def install_server(install_path, version = @version) 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) ⇒ Object
15 16 17 |
# File 'lib/servers/minecraft_spigot.rb', line 15 def launch(install_path) "cd #{install_path} && java -Xms1G -Xmx2G -jar spigot.jar --noconsole" end |
#post_install(install_path, version = @version) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/servers/minecraft_spigot.rb', line 27 def post_install(install_path, version = @version) system("rm -f #{install_path}/eula.txt") system("touch #{install_path}/eula.txt") system("echo 'eula=true' >> #{install_path}/eula.txt") system("mv #{install_path}/spigot-#{version}.jar #{install_path}/spigot.jar") end |