perf: 优化性能
This commit is contained in:
@@ -26,9 +26,10 @@ public final class ServerConfig {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static void init() throws IOException {
|
public static void init() throws IOException {
|
||||||
File configFile = new File("config.yml");
|
File configFile = new File("config.yml");
|
||||||
InputStream stream = Files.newInputStream(configFile.toPath());
|
Map<String, Object> map;
|
||||||
Map<String, Object> map = new Yaml().load(stream);
|
try (InputStream stream = Files.newInputStream(configFile.toPath())) {
|
||||||
stream.close();
|
map = new Yaml().load(stream);
|
||||||
|
}
|
||||||
|
|
||||||
host = (String) map.get("host");
|
host = (String) map.get("host");
|
||||||
port = (int) map.get("port");
|
port = (int) map.get("port");
|
||||||
|
Reference in New Issue
Block a user