Fixed Bukkit server nagging about internal error when setup succeeded.

This commit is contained in:
Rsl1122 2018-02-11 15:44:25 +02:00
parent cdbd8f9496
commit 66b145f7f9
2 changed files with 19 additions and 8 deletions

View File

@ -62,13 +62,15 @@ public class SaveDBSettingsRequest extends InfoRequestWithVariables implements S
return new BadRequestResponse("Bungee config settings overridden on this server."); return new BadRequestResponse("Bungee config settings overridden on this server.");
} }
setSettings(variables); try {
Log.info("----------------------------------"); setSettings(variables);
Log.info("The Received Bungee Database Settings, restarting Plan.."); Log.info("----------------------------------");
Log.info("----------------------------------"); Log.info("The Received Bungee Database Settings, restarting Plan..");
Plan.getInstance().reloadPlugin(true); Log.info("----------------------------------");
return DefaultResponses.SUCCESS.get();
return DefaultResponses.SUCCESS.get(); } finally {
Plan.getInstance().reloadPlugin(true);
}
} }
private void setSettings(Map<String, String> variables) throws BadRequestException { private void setSettings(Map<String, String> variables) throws BadRequestException {

View File

@ -5,6 +5,7 @@
package com.djrapitops.plan.system.info.request; package com.djrapitops.plan.system.info.request;
import com.djrapitops.plan.api.exceptions.connection.BadRequestException; 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.api.exceptions.connection.WebException;
import com.djrapitops.plan.system.info.InfoSystem; import com.djrapitops.plan.system.info.InfoSystem;
import com.djrapitops.plan.system.info.server.Server; 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.api.Check;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
import java.net.SocketException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
@ -74,7 +76,14 @@ public class SendDBSettingsRequest extends InfoRequestWithVariables implements S
Server bukkit = new Server(-1, serverUUID, serverName, address, -1); 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(); return DefaultResponses.SUCCESS.get();
} }