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:
parent
9f433cb0f1
commit
39e164c9c8
@ -108,6 +108,12 @@ All currently supported presets, and available filters for each preset:
|
|||||||
|
|
||||||
## Configuration options
|
## 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
|
### Global-only options
|
||||||
|
|
||||||
| Key | Value type | Description |
|
| Key | Value type | Description |
|
||||||
|
@ -51,6 +51,8 @@ public class BlacksmithPlugin extends JavaPlugin {
|
|||||||
*/
|
*/
|
||||||
public void reload() {
|
public void reload() {
|
||||||
config.load();
|
config.load();
|
||||||
|
this.reloadConfig();
|
||||||
|
Translator.loadLanguages(this.getConfig().getString("language", "en"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -73,7 +75,7 @@ public class BlacksmithPlugin extends JavaPlugin {
|
|||||||
config = new GlobalSettings(this);
|
config = new GlobalSettings(this);
|
||||||
config.load();
|
config.load();
|
||||||
|
|
||||||
Translator.loadLanguages("en");
|
Translator.loadLanguages(fileConfiguration.getString("language", "en"));
|
||||||
|
|
||||||
//Set up Vault integration
|
//Set up Vault integration
|
||||||
if (!setUpVault()) {
|
if (!setUpVault()) {
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
# Blacksmith Configuration
|
# 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
|
# The settings which apply to all Blacksmith NPCs. These can also be changed using the /blacksmithconfig command
|
||||||
global:
|
global:
|
||||||
# The minimum price of each cost
|
# The minimum price of each cost
|
||||||
|
Loading…
Reference in New Issue
Block a user