Decouple IrcConfig from client source set
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -9,9 +9,12 @@ import java.io.Writer;
|
|||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public final class IrcConfig {
|
public final class IrcConfig {
|
||||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(IrcConfig.class);
|
||||||
|
|
||||||
public String host = "127.0.0.1";
|
public String host = "127.0.0.1";
|
||||||
public int port = 24469;
|
public int port = 24469;
|
||||||
@@ -39,12 +42,12 @@ public final class IrcConfig {
|
|||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
} catch (IOException | JsonParseException exception) {
|
} catch (IOException | JsonParseException exception) {
|
||||||
ClientIrcMod.LOGGER.error("Failed to load IRC config from {}", path, exception);
|
LOGGER.error("Failed to load IRC config from {}", path, exception);
|
||||||
IrcConfig fallback = new IrcConfig();
|
IrcConfig fallback = new IrcConfig();
|
||||||
try {
|
try {
|
||||||
fallback.save(path);
|
fallback.save(path);
|
||||||
} catch (IOException ioException) {
|
} catch (IOException ioException) {
|
||||||
ClientIrcMod.LOGGER.error("Failed to save fallback IRC config to {}", path, ioException);
|
LOGGER.error("Failed to save fallback IRC config to {}", path, ioException);
|
||||||
}
|
}
|
||||||
return fallback;
|
return fallback;
|
||||||
}
|
}
|
||||||
@@ -75,4 +78,3 @@ public final class IrcConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user