summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeuin <[email protected]>2021-06-04 19:56:04 +0800
committerKeuin <[email protected]>2021-06-04 19:56:04 +0800
commitce95b8d5debbc8ff3c78da8ab8012a2afe13fd01 (patch)
tree9d698ed0d347def77b187d7aad560a2ff021fe4c
parent17ac6def0ad32702e946805022ebf6f6e7b355ea (diff)
replace anonymous class with lambda expression
-rw-r--r--src/main/java/com/keuin/blame/Blame.java18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/main/java/com/keuin/blame/Blame.java b/src/main/java/com/keuin/blame/Blame.java
index 51e9049..bc3a913 100644
--- a/src/main/java/com/keuin/blame/Blame.java
+++ b/src/main/java/com/keuin/blame/Blame.java
@@ -38,7 +38,8 @@ public class Blame implements ModInitializer {
// load config
File configFile = new File(configFileName);
if (!configFile.exists()) {
- logger.severe(String.format("Failed to read configuration file %s. Blame will be disabled.", configFileName));
+ logger.severe(String.format("Configuration file %s does not exist. " +
+ "Blame will be disabled.", configFileName));
return false;
}
@@ -46,7 +47,7 @@ public class Blame implements ModInitializer {
config = (new Gson()).fromJson(reader, BlameConfig.class);
} catch (IOException exception) {
logger.severe(String.format("Failed to read configuration file %s: %s. " +
- "Blame will be disabled.", configFileName, exception));
+ "Blame will be disabled.", configFileName, exception.getMessage()));
return false;
}
return true;
@@ -64,15 +65,12 @@ public class Blame implements ModInitializer {
DatabaseUtil.disableMongoSpamming();
// hook disable event
- ServerLifecycleEvents.SERVER_STOPPING.register(new ServerLifecycleEvents.ServerStopping() {
- @Override
- public void onServerStopping(MinecraftServer minecraftServer) {
- logger.info("Stopping LookupManager...");
- LookupManager.INSTANCE.stop();
+ ServerLifecycleEvents.SERVER_STOPPING.register(minecraftServer -> {
+ logger.info("Stopping LookupManager...");
+ LookupManager.INSTANCE.stop();
- logger.info("Stopping SubmitWorker...");
- SubmitWorker.INSTANCE.stop();
- }
+ logger.info("Stopping SubmitWorker...");
+ SubmitWorker.INSTANCE.stop();
});
// hook game events