diff options
author | Bryson Steck <brysonsteck@protonmail.com> | 2023-05-24 00:16:49 -0600 |
---|---|---|
committer | Bryson Steck <brysonsteck@protonmail.com> | 2023-05-24 00:16:49 -0600 |
commit | 01f6beb5139d98b29a13bfe389e59bb36c9861a3 (patch) | |
tree | 51764d24e43fba7b1ffc6475f97416384d2ccc8b /src/main/kotlin/xyz/brysonsteck/ServerCraft/server/Server.kt | |
parent | e57a3d6864287c30bb8dfc6f5afdb240f379fbbc (diff) | |
download | ServerCraft-01f6beb5139d98b29a13bfe389e59bb36c9861a3.tar ServerCraft-01f6beb5139d98b29a13bfe389e59bb36c9861a3.tar.gz ServerCraft-01f6beb5139d98b29a13bfe389e59bb36c9861a3.tar.bz2 |
fixed jvm settings being overwritten, hardcore error
Diffstat (limited to 'src/main/kotlin/xyz/brysonsteck/ServerCraft/server/Server.kt')
-rw-r--r-- | src/main/kotlin/xyz/brysonsteck/ServerCraft/server/Server.kt | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main/kotlin/xyz/brysonsteck/ServerCraft/server/Server.kt b/src/main/kotlin/xyz/brysonsteck/ServerCraft/server/Server.kt index b591074..0c3a7d1 100644 --- a/src/main/kotlin/xyz/brysonsteck/ServerCraft/server/Server.kt +++ b/src/main/kotlin/xyz/brysonsteck/ServerCraft/server/Server.kt @@ -33,16 +33,23 @@ public class Server { props.setProperty("level-seed", "") props.setProperty("level-type", "minecraft:normal") props.setProperty("motd", "A server for a dummy") + writeProps() } public fun loadProps(dir: String) { - val ins = File(dir + File.separator + "server.properties").inputStream() + var ins = File(dir + File.separator + "server.properties").inputStream() + props.load(ins) + ins = File(dir + File.separator + "ServerCraft" + File.separator + "ServerCraft.properties").inputStream() props.load(ins) } private fun writeProps() { - val outs = File(dir + File.separator + "server.properties").outputStream() + var outs = File(dir + File.separator + "server.properties").outputStream() props.store(outs, "Minecraft server properties\nCreated with ServerCraft: https://codeberg.org/brysonsteck/ServerCraft") + val temp = Properties() + outs = File(dir + File.separator + "ServerCraft" + File.separator + "ServerCraft.properties").outputStream() + temp.setProperty("jvm-ram", props.getProperty("jvm-ram")) + temp.store(outs, "ServerCraft settings backup\nSometimes, Minecraft will completely overwrite the server.properties file,\ncompletely destroying these app-specific settings. This file backs up these settings\njust in case. :)\nhttps://codeberg.org/brysonsteck/ServerCraft") } public fun getProp(prop: String): String { |