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:
		@@ -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 |
 | 
			
		||||
 
 | 
			
		||||
@@ -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()) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user