aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/world/anhgelus
diff options
context:
space:
mode:
authoranhgelus <anhgelus.morhtuuzh@proton.me>2024-08-23 14:22:41 +0000
committeranhgelus <anhgelus.morhtuuzh@proton.me>2024-08-23 14:22:41 +0000
commit2e87ea59da4e7a3a56f24641c22aeac50cc5b607 (patch)
tree1bb7cc82a5833df6f4d9cea01116016bf62be5b9 /src/main/java/world/anhgelus
parentc6e309f02732eb79a24db6780c4f8f718fac2a29 (diff)
fix(networking): crash while joining server
Diffstat (limited to 'src/main/java/world/anhgelus')
-rw-r--r--src/main/java/world/anhgelus/molehunt/config/SimpleConfig.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/world/anhgelus/molehunt/config/SimpleConfig.java b/src/main/java/world/anhgelus/molehunt/config/SimpleConfig.java
index ef8bef3..2b65829 100644
--- a/src/main/java/world/anhgelus/molehunt/config/SimpleConfig.java
+++ b/src/main/java/world/anhgelus/molehunt/config/SimpleConfig.java
@@ -2,7 +2,7 @@ package world.anhgelus.molehunt.config;
/*
* Copyright (c) 2021 magistermaks
- * Slightly modified by Léo-21
+ * Slightly modified by Léo-21 and Anhgelus Morhtuuzh
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@ import org.apache.logging.log4j.Logger;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
+import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashMap;
@@ -110,7 +111,7 @@ public class SimpleConfig {
Files.createFile( request.file.toPath() );
// write default config data
- PrintWriter writer = new PrintWriter(request.file, "UTF-8");
+ PrintWriter writer = new PrintWriter(request.file, StandardCharsets.UTF_8);
writer.write( request.getConfig() );
writer.close();
@@ -139,12 +140,12 @@ public class SimpleConfig {
String identifier = "Config '" + request.filename + "'";
if( !request.file.exists() ) {
- LOGGER.info( identifier + " is missing, generating default one..." );
+ LOGGER.info("{} is missing, generating default one...", identifier);
try {
createConfig();
} catch (IOException e) {
- LOGGER.error( identifier + " failed to generate!" );
+ LOGGER.error("{} failed to generate!", identifier);
LOGGER.trace( e );
broken = true;
}
@@ -154,7 +155,7 @@ public class SimpleConfig {
try {
loadConfig();
} catch (Exception e) {
- LOGGER.error( identifier + " failed to load!" );
+ LOGGER.error("{} failed to load!", identifier);
LOGGER.trace( e );
broken = true;
}
@@ -245,7 +246,7 @@ public class SimpleConfig {
* @return true if the operation was successful
*/
public boolean delete() {
- LOGGER.warn( "Config '" + request.filename + "' was removed from existence! Restart the game to regenerate it." );
+ LOGGER.warn("Config '{}' was removed from existence! Restart the game to regenerate it.", request.filename);
return request.file.delete();
}