Fixes reload bug when locale folder is missing.

https://github.com/BentoBoxWorld/bentobox/issues/385
This commit is contained in:
tastybento 2018-12-15 23:38:20 -08:00
parent 3b87ff7aae
commit b556b7160e
2 changed files with 8 additions and 6 deletions

View File

@ -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
}
/**
@ -170,6 +171,7 @@ public class LocalesManager {
*/
public void reloadLanguages() {
languages.clear();
copyLocalesFromJar(plugin.getName());
loadLocalesFromFile(plugin.getName());
plugin.getAddonsManager().getAddons().forEach(addon -> loadLocalesFromFile(addon.getDescription().getName()));
}

View File

@ -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;