mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-01 14:39:13 -06:00
Move test.conf to resources, add path parsing for resource URLs
This commit is contained in:
parent
fc7be0922b
commit
d225cd694d
3 changed files with 84 additions and 3 deletions
|
|
@ -10,6 +10,7 @@ import rs09.game.system.SystemLogger
|
|||
import rs09.game.world.GameSettings
|
||||
import rs09.game.world.GameWorld
|
||||
import java.io.File
|
||||
import java.net.URL
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
/**
|
||||
|
|
@ -23,8 +24,17 @@ object ServerConfigParser {
|
|||
|
||||
fun parse(path: String){
|
||||
confFile = File(parsePath(path))
|
||||
parseFromFile(confFile)
|
||||
}
|
||||
|
||||
fun parse(path: URL?) {
|
||||
confFile = File(path!!.toURI())
|
||||
parseFromFile(confFile)
|
||||
}
|
||||
|
||||
private fun parseFromFile(confFile: File?) {
|
||||
if(!confFile!!.canonicalFile.exists()){
|
||||
SystemLogger.logErr("${confFile!!.canonicalFile} does not exist in the current working directory.")
|
||||
SystemLogger.logErr("${confFile.canonicalFile} does not exist.")
|
||||
exitProcess(0)
|
||||
} else {
|
||||
try {
|
||||
|
|
@ -32,7 +42,7 @@ object ServerConfigParser {
|
|||
parseServerSettings()
|
||||
parseGameSettings()
|
||||
} catch (e: java.lang.IllegalStateException) {
|
||||
SystemLogger.logErr("Passed config file is not a TOML file. Path: ${confFile!!.canonicalPath}")
|
||||
SystemLogger.logErr("Passed config file is not a TOML file. Path: ${confFile.canonicalPath}")
|
||||
SystemLogger.logErr("Exception received: $e")
|
||||
SystemLogger.logAlert("Shutting down...")
|
||||
exitProcess(0)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ object TestUtils {
|
|||
|
||||
fun preTestSetup() {
|
||||
if(ServerConstants.DATA_PATH == null) {
|
||||
ServerConfigParser.parse("worldprops/test.conf")
|
||||
ServerConfigParser.parse(this::class.java.getResource("test.conf"))
|
||||
Cache.init(this::class.java.getResource("cache").path.toString())
|
||||
ConfigParser().prePlugin()
|
||||
ConfigParser().postPlugin()
|
||||
|
|
|
|||
71
Server/src/test/resources/test.conf
Normal file
71
Server/src/test/resources/test.conf
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
[server]
|
||||
#Secret key - this is sent by the client during login.
|
||||
#Client/Server MUST match or connection is refused.
|
||||
secret_key = "2009scape_development"
|
||||
write_logs = true
|
||||
msip = "127.0.0.1"
|
||||
|
||||
[database]
|
||||
database_name = "global"
|
||||
database_username = "root"
|
||||
database_password = ""
|
||||
database_address = "127.0.0.1"
|
||||
database_port = "3306"
|
||||
|
||||
|
||||
[world]
|
||||
name = "2009scape"
|
||||
debug = true
|
||||
dev = true
|
||||
start_gui = false
|
||||
daily_restart = true
|
||||
#world number
|
||||
world_id = "1"
|
||||
country_id = "0"
|
||||
members = true
|
||||
#activity as displayed on the world list
|
||||
activity = "2009scape classic."
|
||||
pvp = false
|
||||
default_xp_rate = 5.0
|
||||
allow_slayer_reroll = false
|
||||
#enables a default clan for players to join automatically. Should be an account with the same name as @name, with a clan set up already.
|
||||
enable_default_clan = true
|
||||
enable_bots = true
|
||||
#message of the week model ID, 0 for random
|
||||
motw_identifier = "0"
|
||||
#text shown for message of the week - @name will be replaced with the name property set above.
|
||||
motw_text = "Welcome to @name!"
|
||||
#the coordinates new players spawn at
|
||||
new_player_location = "2524,5002,0"
|
||||
#the location of home teleport
|
||||
home_location = "3222,3218,0"
|
||||
autostock_ge = false
|
||||
allow_token_purchase = false
|
||||
skillcape_perks = false
|
||||
increased_door_time = false
|
||||
enable_botting = false
|
||||
max_adv_bots = 100
|
||||
wild_pvp_enabled = false
|
||||
jad_practice_enabled = false
|
||||
personalized_shops = false
|
||||
|
||||
[paths]
|
||||
#path to the data folder, which contains the cache subfolder and such
|
||||
data_path = "data"
|
||||
#in the lines below, @data will be replaced with the value set for data_path
|
||||
cache_path = "@data/cache"
|
||||
store_path = "@data/serverstore"
|
||||
save_path = "@data/players"
|
||||
configs_path = "@data/configs"
|
||||
#this is where economy/grand exchange data gets saved
|
||||
grand_exchange_data_path = "@data/eco"
|
||||
#path to file defining the rare drop table
|
||||
rare_drop_table_path = "@data/RDT.xml"
|
||||
#path to file defining c.ele minor drop table
|
||||
cele_drop_table_path = "@data/CELEDT.xml"
|
||||
#path to file containing boot-time object changes
|
||||
object_parser_path = "@data/ObjectParser.xml"
|
||||
#path logs are written to
|
||||
logs_path = "@data/logs"
|
||||
bot_data = "@data/botdata"
|
||||
eco_data = "@data/eco"
|
||||
Loading…
Add table
Add a link
Reference in a new issue