Makes the language selectable

This commit is contained in:
Kristian Knarvik 2023-07-08 03:34:37 +02:00
parent d65f288dc1
commit 13f3de32fa
2 changed files with 6 additions and 1 deletions

View File

@ -28,6 +28,7 @@ public final class Launchpad extends JavaPlugin {
private static Launchpad instance;
private LaunchpadConfiguration launchpadConfiguration;
private Translator translator;
private StringFormatter stringFormatter;
/**
@ -45,6 +46,7 @@ public final class Launchpad extends JavaPlugin {
public void reload() {
reloadConfig();
this.getConfiguration().load(this.getConfig());
this.translator.loadLanguages(this.getDataFolder(), "en", getConfig().getString("language", "en"));
}
/**
@ -83,7 +85,8 @@ public final class Launchpad extends JavaPlugin {
Translator translator = new Translator();
translator.registerMessageCategory(LaunchpadMessage.ERROR_PLAYER_ONLY);
translator.setColorConversion(ColorConversion.RGB);
translator.loadLanguages(this.getDataFolder(), "en", "en");
translator.loadLanguages(this.getDataFolder(), "en", getConfig().getString("language", "en"));
this.translator = translator;
this.stringFormatter = new StringFormatter(this.getDescription().getName(), translator);
this.stringFormatter.setColorConversion(ColorConversion.RGB);
this.stringFormatter.setNamePrefix("#FFE34C[");

View File

@ -1,3 +1,5 @@
# The chosen language for Launchpad. You can use "en" or any custom language specified in strings.yml
language: en
launchpad:
# A list of all materials automatically enabled as a launch-pad. Use +PRESSURE_PLATES for all pressure plates, or
# +WOODEN_PRESSURE_PLATES for all wooden pressure plates.