Class: MinecraftSpigot

Inherits:
Object
  • Object
show all
Defined in:
lib/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.



9
10
11
12
# File 'lib/servers/minecraft_spigot.rb', line 9

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

Instance Attribute Details

#app_idObject (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

#nameObject (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