From ce95b8d5debbc8ff3c78da8ab8012a2afe13fd01 Mon Sep 17 00:00:00 2001 From: Keuin Date: Fri, 4 Jun 2021 19:56:04 +0800 Subject: replace anonymous class with lambda expression --- src/main/java/com/keuin/blame/Blame.java | 18 ++++++++---------- 1 file 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 -- cgit v1.2.3