From 66b145f7f97a714553186329001557def3d4cd28 Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Sun, 11 Feb 2018 15:44:25 +0200 Subject: [PATCH] Fixed Bukkit server nagging about internal error when setup succeeded. --- .../info/request/SaveDBSettingsRequest.java | 16 +++++++++------- .../info/request/SendDBSettingsRequest.java | 11 ++++++++++- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/request/SaveDBSettingsRequest.java b/Plan/src/main/java/com/djrapitops/plan/system/info/request/SaveDBSettingsRequest.java index 55d66e35c..ef3b2a254 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/info/request/SaveDBSettingsRequest.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/info/request/SaveDBSettingsRequest.java @@ -62,13 +62,15 @@ public class SaveDBSettingsRequest extends InfoRequestWithVariables implements S return new BadRequestResponse("Bungee config settings overridden on this server."); } - setSettings(variables); - Log.info("----------------------------------"); - Log.info("The Received Bungee Database Settings, restarting Plan.."); - Log.info("----------------------------------"); - Plan.getInstance().reloadPlugin(true); - - return DefaultResponses.SUCCESS.get(); + try { + setSettings(variables); + Log.info("----------------------------------"); + Log.info("The Received Bungee Database Settings, restarting Plan.."); + Log.info("----------------------------------"); + return DefaultResponses.SUCCESS.get(); + } finally { + Plan.getInstance().reloadPlugin(true); + } } private void setSettings(Map variables) throws BadRequestException { diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/request/SendDBSettingsRequest.java b/Plan/src/main/java/com/djrapitops/plan/system/info/request/SendDBSettingsRequest.java index f0db5ac7f..8097da8a0 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/info/request/SendDBSettingsRequest.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/info/request/SendDBSettingsRequest.java @@ -5,6 +5,7 @@ package com.djrapitops.plan.system.info.request; import com.djrapitops.plan.api.exceptions.connection.BadRequestException; +import com.djrapitops.plan.api.exceptions.connection.ConnectionFailException; import com.djrapitops.plan.api.exceptions.connection.WebException; import com.djrapitops.plan.system.info.InfoSystem; import com.djrapitops.plan.system.info.server.Server; @@ -15,6 +16,7 @@ import com.djrapitops.plan.system.webserver.response.api.BadRequestResponse; import com.djrapitops.plugin.api.Check; import com.djrapitops.plugin.utilities.Verify; +import java.net.SocketException; import java.util.HashMap; import java.util.Map; import java.util.UUID; @@ -74,7 +76,14 @@ public class SendDBSettingsRequest extends InfoRequestWithVariables implements S Server bukkit = new Server(-1, serverUUID, serverName, address, -1); - InfoSystem.getInstance().getConnectionSystem().sendInfoRequest(new SaveDBSettingsRequest(), bukkit); + try { + InfoSystem.getInstance().getConnectionSystem().sendInfoRequest(new SaveDBSettingsRequest(), bukkit); + } catch (ConnectionFailException e) { + Throwable cause = e.getCause(); + if (!(cause instanceof SocketException) || !cause.getMessage().contains("Unexpected end of file from server")) { + throw e; + } + } return DefaultResponses.SUCCESS.get(); }