[FIX] Исправлена работа JsonConfigurable

This commit is contained in:
Gravit 2019-06-07 05:27:46 +07:00
parent 95f5ff13c3
commit 91b7b2cd06
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -9,6 +9,7 @@
import pro.gravit.launcher.Launcher;
import pro.gravit.launcher.LauncherAPI;
import pro.gravit.utils.helper.IOHelper;
import pro.gravit.utils.helper.LogHelper;
public abstract class JsonConfigurable<T> {
private Type type;
@ -42,6 +43,10 @@ public void loadConfig(Path configPath) throws IOException {
if (generateConfigIfNotExists(configPath)) return;
try (BufferedReader reader = IOHelper.newReader(configPath)) {
setConfig(Launcher.gsonManager.configGson.fromJson(reader, type));
} catch (Exception e)
{
LogHelper.error(e);
resetConfig(configPath);
}
}