mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-18 10:32:30 +00:00
Fix minor config reloading issues
This commit is contained in:
parent
94ec66a593
commit
d2c8e862e7
@ -102,7 +102,7 @@ public class ConfigPack extends YamlConfiguration {
|
||||
biomeList = getStringList("grids");
|
||||
|
||||
configs.put(id, this);
|
||||
LangUtil.log("config-pack.load", Level.INFO, getID(), String.valueOf((System.nanoTime() - l)/1000000D));
|
||||
LangUtil.log("config-pack.loaded", Level.INFO, getID(), String.valueOf((System.nanoTime() - l)/1000000D));
|
||||
}
|
||||
|
||||
public Map<String, AbstractBiomeConfig> getAbstractBiomes() {
|
||||
|
@ -22,6 +22,7 @@ public final class ConfigUtil {
|
||||
public static boolean masterDisableCaves;
|
||||
public static void loadConfig(JavaPlugin main) {
|
||||
main.saveDefaultConfig();
|
||||
main.reloadConfig();
|
||||
FileConfiguration config = main.getConfig();
|
||||
LangUtil.load(config.getString("language", "en_us"), main);
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class WorldConfig {
|
||||
fromImage = false;
|
||||
}
|
||||
}
|
||||
} catch(IllegalArgumentException e) {
|
||||
} catch(IllegalArgumentException | NullPointerException e) {
|
||||
throw new InvalidConfigurationException(e.getCause());
|
||||
}
|
||||
Bukkit.getLogger().info("Loaded " + tConfig.biomeList.size() + " BiomeGrids from list.");
|
||||
|
@ -6,9 +6,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Language extends YamlConfiguration {
|
||||
public Language(File file) throws IOException, InvalidConfigurationException {
|
||||
@ -18,13 +16,14 @@ public class Language extends YamlConfiguration {
|
||||
public void load(@NotNull File file) throws IOException, InvalidConfigurationException {
|
||||
super.load(file);
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public Message getMessage(String id) {
|
||||
Object m = get(id);
|
||||
Message temp;
|
||||
if(m instanceof List) {
|
||||
temp = new MultiLineMessage(getStringList(id));
|
||||
temp = new MultiLineMessage((List<String>) m);
|
||||
} else if(m instanceof String) {
|
||||
temp = new SingleLineMessage(getString(id));
|
||||
temp = new SingleLineMessage((String) m);
|
||||
} else return new SingleLineMessage("message:" + id + ":translation_undefined");
|
||||
if(temp.isEmpty()) return new SingleLineMessage("message:" + id + ":translation_undefined");
|
||||
return temp;
|
||||
|
Loading…
x
Reference in New Issue
Block a user