Implements language selection properly

Adds a configuration option for the plugin language
Loads the selected language instead of always loading "en"
Makes sure the language is updated upon reloading
This commit is contained in:
Kristian Knarvik 2022-10-21 00:46:01 +02:00
parent 9f433cb0f1
commit 39e164c9c8
3 changed files with 12 additions and 1 deletions

View File

@ -108,6 +108,12 @@ All currently supported presets, and available filters for each preset:
## Configuration options
### Plugin Options
| Key | Value type | Description |
| --- | --- | --- |
| language | string | The language used for this plugin. Only "en" is supported, unless you add a custom language. |
### Global-only options
| Key | Value type | Description |

View File

@ -51,6 +51,8 @@ public class BlacksmithPlugin extends JavaPlugin {
*/
public void reload() {
config.load();
this.reloadConfig();
Translator.loadLanguages(this.getConfig().getString("language", "en"));
}
@Override
@ -73,7 +75,7 @@ public class BlacksmithPlugin extends JavaPlugin {
config = new GlobalSettings(this);
config.load();
Translator.loadLanguages("en");
Translator.loadLanguages(fileConfiguration.getString("language", "en"));
//Set up Vault integration
if (!setUpVault()) {

View File

@ -1,5 +1,8 @@
# Blacksmith Configuration
# The language used for messages. Only "en" is supported
language: en
# The settings which apply to all Blacksmith NPCs. These can also be changed using the /blacksmithconfig command
global:
# The minimum price of each cost