class MinecraftSpigot

Attributes

app_id[R]
name[R]

Public Class Methods

new() click to toggle source
# File lib/servers/minecraft_spigot.rb, line 8
def initialize
  @name = "minecraft"
  @app_id = nil
  @version = "1.15.1"
end

Public Instance Methods

install_server(install_path, version = @version) click to toggle source
# File lib/servers/minecraft_spigot.rb, line 18
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 -Xmx1024M -jar #{install_path}/BuildTools.jar --rev #{version}")
end
launch(install_path) click to toggle source
# File lib/servers/minecraft_spigot.rb, line 14
def launch(install_path)
  "cd #{install_path} && java -Xms1G -Xmx2G -jar spigot.jar --noconsole"
end
post_install(install_path, version = @version) click to toggle source
# File lib/servers/minecraft_spigot.rb, line 26
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