aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/java/world/anhgelus/molehunt/client/MolehuntClient.java12
-rw-r--r--src/main/java/world/anhgelus/molehunt/config/SimpleConfig.java13
2 files changed, 12 insertions, 13 deletions
diff --git a/src/client/java/world/anhgelus/molehunt/client/MolehuntClient.java b/src/client/java/world/anhgelus/molehunt/client/MolehuntClient.java
index 7770a1b..1f92573 100644
--- a/src/client/java/world/anhgelus/molehunt/client/MolehuntClient.java
+++ b/src/client/java/world/anhgelus/molehunt/client/MolehuntClient.java
@@ -13,13 +13,11 @@ public class MolehuntClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
ClientPlayNetworking.registerGlobalReceiver(ConfigPayload.ID, (payload, context) -> {
- try (final var client = context.client()) {
- client.execute(() -> {
- SHOW_SKINS = payload.showSkins();
- SHOW_NAMETAGS = payload.showNametags();
- SHOW_TAB = payload.showTab();
- });
- }
+ context.client().execute(() -> {
+ SHOW_SKINS = payload.showSkins();
+ SHOW_NAMETAGS = payload.showNametags();
+ SHOW_TAB = payload.showTab();
+ });
});
}
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();
}