()
| 95 | } |
| 96 | |
| 97 | func loadConfig() properties.ServerProperties { |
| 98 | file, err := os.ReadFile("server.properties") |
| 99 | if err != nil { |
| 100 | file, err := os.Create("server.properties") |
| 101 | if err == nil { |
| 102 | properties.Marshal(file, properties.Default) |
| 103 | file.Close() |
| 104 | } |
| 105 | return properties.Default |
| 106 | } |
| 107 | var cfg properties.ServerProperties |
| 108 | |
| 109 | err = properties.Unmarshal(string(file), &cfg) |
| 110 | if err != nil { |
| 111 | cfg = properties.Default |
| 112 | } |
| 113 | |
| 114 | return cfg |
| 115 | } |