Fixed Bungee functionality

This commit is contained in:
Rsl1122 2017-11-12 20:15:30 +02:00
parent f719f81abb
commit 697512acfd
4 changed files with 10 additions and 9 deletions

View File

@ -7,10 +7,7 @@ package main.java.com.djrapitops.plan.systems.info;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import main.java.com.djrapitops.plan.Plan; import main.java.com.djrapitops.plan.Plan;
import main.java.com.djrapitops.plan.Settings; import main.java.com.djrapitops.plan.Settings;
import main.java.com.djrapitops.plan.api.exceptions.ParseException; import main.java.com.djrapitops.plan.api.exceptions.*;
import main.java.com.djrapitops.plan.api.exceptions.WebAPIConnectionFailException;
import main.java.com.djrapitops.plan.api.exceptions.WebAPIException;
import main.java.com.djrapitops.plan.api.exceptions.WebAPIFailException;
import main.java.com.djrapitops.plan.command.commands.AnalyzeCommand; import main.java.com.djrapitops.plan.command.commands.AnalyzeCommand;
import main.java.com.djrapitops.plan.data.AnalysisData; import main.java.com.djrapitops.plan.data.AnalysisData;
import main.java.com.djrapitops.plan.data.additional.HookHandler; import main.java.com.djrapitops.plan.data.additional.HookHandler;
@ -302,6 +299,8 @@ public class BukkitInformationManager extends InformationManager {
return true; return true;
} catch (WebAPIConnectionFailException e) { } catch (WebAPIConnectionFailException e) {
plugin.getServerInfoManager().markConnectionFail(); plugin.getServerInfoManager().markConnectionFail();
} catch (WebAPINotFoundException e) {
Log.info("Bungee reported that UUID of this server is not in the MySQL-database. Try using '/plan m setup " + webServerAddress + "' again");
} catch (WebAPIException e) { } catch (WebAPIException e) {
Log.toLog(this.getClass().getName(), e); Log.toLog(this.getClass().getName(), e);
} }

View File

@ -117,15 +117,17 @@ public class BungeeServerInfoManager {
} }
public void sendConfigSettings(UUID serverUUID) { public void sendConfigSettings(UUID serverUUID) {
String webAddress = null;
try { try {
ServerInfo server = bukkitServers.get(serverUUID); ServerInfo server = bukkitServers.get(serverUUID);
if (server == null) { if (server == null) {
return; return;
} }
String webAddress = server.getWebAddress(); webAddress = server.getWebAddress();
Log.debug("Sending config settings to " + webAddress + ""); Log.debug("Sending config settings to " + webAddress + "");
plugin.getWebServer().getWebAPI().getAPI(ConfigurationWebAPI.class).sendRequest(webAddress, serverUUID); plugin.getWebServer().getWebAPI().getAPI(ConfigurationWebAPI.class).sendRequest(webAddress, serverUUID);
} catch (WebAPIException e) { } catch (WebAPIException e) {
Log.info("Connection to Bukkit (" + webAddress + ") did not succeed.");
serverHasGoneOffline(serverUUID); serverHasGoneOffline(serverUUID);
} }
} }
@ -178,7 +180,6 @@ public class BungeeServerInfoManager {
} }
public void serverHasGoneOffline(UUID serverUUID) { public void serverHasGoneOffline(UUID serverUUID) {
Log.debug("Bukkit Server Marked Offline");
onlineServers.remove(serverUUID); onlineServers.remove(serverUUID);
} }
} }

View File

@ -39,7 +39,9 @@ public class APIRequestHandler implements HttpHandler {
response.setResponseHeaders(responseHeaders); response.setResponseHeaders(responseHeaders);
response.send(exchange); response.send(exchange);
} catch (Exception e) { } catch (Exception e) {
Log.toLog(this.getClass().getName(), e); if (Settings.DEV_MODE.isTrue()) {
Log.toLog(this.getClass().getName(), e);
}
} finally { } finally {
exchange.close(); exchange.close();
} }

View File

@ -14,14 +14,13 @@ import java.util.*;
public class WebAPIManager { public class WebAPIManager {
private final Map<String, WebAPI> registry; private final Map<String, WebAPI> registry;
private final Set<String> accessKeys; private static final Set<String> accessKeys = new HashSet<>();
/** /**
* Constructor used to hide the public constructor * Constructor used to hide the public constructor
*/ */
public WebAPIManager() { public WebAPIManager() {
registry = new HashMap<>(); registry = new HashMap<>();
accessKeys = new HashSet<>();
} }
public void registerNewAPI(WebAPI... api) { public void registerNewAPI(WebAPI... api) {