mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 11:45:31 +01:00
Fixes reload bug when locale folder is missing.
https://github.com/BentoBoxWorld/bentobox/issues/385
This commit is contained in:
parent
3b87ff7aae
commit
b556b7160e
@ -27,11 +27,12 @@ public class LocalesManager {
|
||||
private BentoBox plugin;
|
||||
private Map<Locale, BentoBoxLocale> languages = new HashMap<>();
|
||||
private static final String LOCALE_FOLDER = "locales";
|
||||
private static final String BENTOBOX = "BentoBox";
|
||||
|
||||
public LocalesManager(BentoBox plugin) {
|
||||
this.plugin = plugin;
|
||||
copyLocalesFromJar(plugin.getName());
|
||||
loadLocalesFromFile(plugin.getName()); // Default
|
||||
copyLocalesFromJar(BENTOBOX);
|
||||
loadLocalesFromFile(BENTOBOX); // Default
|
||||
}
|
||||
|
||||
/**
|
||||
@ -95,10 +96,10 @@ public class LocalesManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads all the locales available in the locale folder given. Used for loading all locales from plugin and addons
|
||||
*
|
||||
*
|
||||
* @param localeFolder - locale folder location relative to the plugin's data folder
|
||||
*/
|
||||
public void loadLocalesFromFile(String localeFolder) {
|
||||
@ -164,12 +165,13 @@ public class LocalesManager {
|
||||
public Map<Locale, BentoBoxLocale> getLanguages() {
|
||||
return this.languages;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reloads all the language files from the filesystem
|
||||
*/
|
||||
public void reloadLanguages() {
|
||||
languages.clear();
|
||||
copyLocalesFromJar(plugin.getName());
|
||||
loadLocalesFromFile(plugin.getName());
|
||||
plugin.getAddonsManager().getAddons().forEach(addon -> loadLocalesFromFile(addon.getDescription().getName()));
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ import world.bentobox.bentobox.util.Util;
|
||||
@PrepareForTest( { Bukkit.class, BentoBox.class, Util.class, Location.class })
|
||||
public class IslandsManagerTest {
|
||||
|
||||
private static BentoBox plugin;
|
||||
private BentoBox plugin;
|
||||
private UUID uuid;
|
||||
private User user;
|
||||
private PlayersManager pm;
|
||||
|
Loading…
Reference in New Issue
Block a user