Commit c930c637 authored by Melledy's avatar Melledy
Browse files

Add languages folder to config as well

parent 0eab44f5
...@@ -16,6 +16,7 @@ public final class Config { ...@@ -16,6 +16,7 @@ public final class Config {
public String KEY_FOLDER = "./keys/"; public String KEY_FOLDER = "./keys/";
public String SCRIPTS_FOLDER = "./resources/Scripts/"; public String SCRIPTS_FOLDER = "./resources/Scripts/";
public String PLUGINS_FOLDER = "./plugins/"; public String PLUGINS_FOLDER = "./plugins/";
public String LANGUAGE_FOLDER = "./languages/";
public ServerDebugMode DebugMode = ServerDebugMode.NONE; // ALL, MISSING, NONE public ServerDebugMode DebugMode = ServerDebugMode.NONE; // ALL, MISSING, NONE
public ServerRunMode RunMode = ServerRunMode.HYBRID; // HYBRID, DISPATCH_ONLY, GAME_ONLY public ServerRunMode RunMode = ServerRunMode.HYBRID; // HYBRID, DISPATCH_ONLY, GAME_ONLY
......
...@@ -134,7 +134,7 @@ public final class Grasscutter { ...@@ -134,7 +134,7 @@ public final class Grasscutter {
} }
public static void loadLanguage() { public static void loadLanguage() {
try (FileReader file = new FileReader(String.format("./language/%s.json", Grasscutter.config.Language))) { try (FileReader file = new FileReader(String.format(getConfig().LANGUAGE_FOLDER + "%s.json", Grasscutter.config.Language))) {
language = gson.fromJson(file, Language.class); language = gson.fromJson(file, Language.class);
} catch (Exception e) { } catch (Exception e) {
Grasscutter.language = new Language(); Grasscutter.language = new Language();
...@@ -183,7 +183,7 @@ public final class Grasscutter { ...@@ -183,7 +183,7 @@ public final class Grasscutter {
} }
} }
} catch (Exception e) { } catch (Exception e) {
Grasscutter.getLogger().error(language.error, e); Grasscutter.getLogger().error(language.Error, e);
} }
} }
......
...@@ -9,8 +9,8 @@ public final class Language { ...@@ -9,8 +9,8 @@ public final class Language {
public String Start_done = "Done! For help, type \"help\""; public String Start_done = "Done! For help, type \"help\"";
public String Dispatch_mode_not_support_command = "Commands are not supported in dispatch only mode."; public String Dispatch_mode_not_support_command = "Commands are not supported in dispatch only mode.";
public String Command_error = "Command error:"; public String Command_error = "Command error:";
public String error = "An error occurred."; public String Error = "An error occurred.";
public String grasscutter_is_free = "Grasscutter is FREE software. If you have paid for this, you may have been scammed. Homepage: https://github.com/Grasscutters/Grasscutter"; public String Grasscutter_is_free = "Grasscutter is FREE software. If you have paid for this, you may have been scammed. Homepage: https://github.com/Grasscutters/Grasscutter";
public String Game_start_port = "Game Server started on port %s"; public String Game_start_port = "Game Server started on port %s";
public String Client_connect = "Client connected from %s"; public String Client_connect = "Client connected from %s";
public String Client_disconnect = "Client disconnected from %s"; public String Client_disconnect = "Client disconnected from %s";
......
...@@ -207,7 +207,7 @@ public final class GameServer extends KcpServer { ...@@ -207,7 +207,7 @@ public final class GameServer extends KcpServer {
@Override @Override
public void onStartFinish() { public void onStartFinish() {
Grasscutter.getLogger().info(Grasscutter.getLanguage().grasscutter_is_free); Grasscutter.getLogger().info(Grasscutter.getLanguage().Grasscutter_is_free);
Grasscutter.getLogger().info(String.format(Grasscutter.getLanguage().Game_start_port, address.getPort())); Grasscutter.getLogger().info(String.format(Grasscutter.getLanguage().Game_start_port, address.getPort()));
ServerStartEvent event = new ServerStartEvent(ServerEvent.Type.GAME, OffsetDateTime.now()); event.call(); ServerStartEvent event = new ServerStartEvent(ServerEvent.Type.GAME, OffsetDateTime.now()); event.call();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment