Prevented some connection attempt loops from happening

This commit is contained in:
Rsl1122 2017-11-10 09:28:11 +02:00
parent 7472bb9f88
commit d7efc7a04d

View File

@ -10,6 +10,7 @@ import main.java.com.djrapitops.plan.Settings;
import main.java.com.djrapitops.plan.api.exceptions.ParseException; import main.java.com.djrapitops.plan.api.exceptions.ParseException;
import main.java.com.djrapitops.plan.api.exceptions.WebAPIConnectionFailException; 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.WebAPIException;
import main.java.com.djrapitops.plan.api.exceptions.WebAPIForbiddenException;
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;
@ -82,6 +83,8 @@ public class BukkitInformationManager extends InformationManager {
} else if (usingAnotherWebServer) { } else if (usingAnotherWebServer) {
try { try {
getWebAPI().getAPI(AnalyzeWebAPI.class).sendRequest(webServerAddress, serverUUID); getWebAPI().getAPI(AnalyzeWebAPI.class).sendRequest(webServerAddress, serverUUID);
} catch (WebAPIForbiddenException ignored) {
/* Do nothing */
} catch (WebAPIException e) { } catch (WebAPIException e) {
attemptConnection(); attemptConnection();
refreshAnalysis(serverUUID); refreshAnalysis(serverUUID);
@ -95,6 +98,8 @@ public class BukkitInformationManager extends InformationManager {
if (usingAnotherWebServer) { if (usingAnotherWebServer) {
try { try {
getWebAPI().getAPI(PostHtmlWebAPI.class).sendInspectHtml(webServerAddress, uuid, getPlayerHtml(uuid)); getWebAPI().getAPI(PostHtmlWebAPI.class).sendInspectHtml(webServerAddress, uuid, getPlayerHtml(uuid));
} catch (WebAPIForbiddenException ignored) {
/* Do nothing */
} catch (WebAPIException e) { } catch (WebAPIException e) {
attemptConnection(); attemptConnection();
cachePlayer(uuid); cachePlayer(uuid);
@ -118,6 +123,8 @@ public class BukkitInformationManager extends InformationManager {
if (usingAnotherWebServer && !origin.equals(RequestInspectPluginsTabBukkitWebAPI.class)) { if (usingAnotherWebServer && !origin.equals(RequestInspectPluginsTabBukkitWebAPI.class)) {
try { try {
getWebAPI().getAPI(RequestPluginsTabWebAPI.class).sendRequest(webServerAddress, uuid); getWebAPI().getAPI(RequestPluginsTabWebAPI.class).sendRequest(webServerAddress, uuid);
} catch (WebAPIForbiddenException ignored) {
/* Do nothing */
} catch (WebAPIException e) { } catch (WebAPIException e) {
attemptConnection(); attemptConnection();
cacheInspectPluginsTab(uuid, origin); cacheInspectPluginsTab(uuid, origin);
@ -136,6 +143,8 @@ public class BukkitInformationManager extends InformationManager {
if (usingAnotherWebServer) { if (usingAnotherWebServer) {
try { try {
getWebAPI().getAPI(PostInspectPluginsTabWebAPI.class).sendPluginsTab(webServerAddress, uuid, contents); getWebAPI().getAPI(PostInspectPluginsTabWebAPI.class).sendPluginsTab(webServerAddress, uuid, contents);
} catch (WebAPIForbiddenException ignored) {
/* Do nothing */
} catch (WebAPIException e) { } catch (WebAPIException e) {
attemptConnection(); attemptConnection();
cacheInspectPluginsTab(uuid, contents); cacheInspectPluginsTab(uuid, contents);
@ -160,6 +169,8 @@ public class BukkitInformationManager extends InformationManager {
if (usingAnotherWebServer) { if (usingAnotherWebServer) {
try { try {
return getWebAPI().getAPI(IsCachedWebAPI.class).isInspectCached(webServerAddress, uuid); return getWebAPI().getAPI(IsCachedWebAPI.class).isInspectCached(webServerAddress, uuid);
} catch (WebAPIForbiddenException ignored) {
/* Do nothing */
} catch (WebAPIException e) { } catch (WebAPIException e) {
attemptConnection(); attemptConnection();
return isCached(uuid); return isCached(uuid);
@ -176,6 +187,8 @@ public class BukkitInformationManager extends InformationManager {
if (usingAnotherWebServer) { if (usingAnotherWebServer) {
try { try {
return getWebAPI().getAPI(IsCachedWebAPI.class).isAnalysisCached(webServerAddress, serverUUID); return getWebAPI().getAPI(IsCachedWebAPI.class).isAnalysisCached(webServerAddress, serverUUID);
} catch (WebAPIForbiddenException ignored) {
/* Do nothing */
} catch (WebAPIException e) { } catch (WebAPIException e) {
attemptConnection(); attemptConnection();
return isAnalysisCached(serverUUID); return isAnalysisCached(serverUUID);
@ -235,6 +248,8 @@ public class BukkitInformationManager extends InformationManager {
getWebAPI().getAPI(AnalysisReadyWebAPI.class).sendRequest(webServerAddress, serverUUID); getWebAPI().getAPI(AnalysisReadyWebAPI.class).sendRequest(webServerAddress, serverUUID);
updateNetworkPageContent(); updateNetworkPageContent();
return; return;
} catch (WebAPIForbiddenException ignored) {
/* Do nothing */
} catch (WebAPIException e) { } catch (WebAPIException e) {
attemptConnection(); attemptConnection();
} }
@ -250,9 +265,11 @@ public class BukkitInformationManager extends InformationManager {
if (usingAnotherWebServer) { if (usingAnotherWebServer) {
try { try {
getWebAPI().getAPI(PostHtmlWebAPI.class).sendAnalysisHtml(webServerAddress, html); getWebAPI().getAPI(PostHtmlWebAPI.class).sendAnalysisHtml(webServerAddress, html);
} catch (WebAPIForbiddenException ignored) {
/* Do nothing */
} catch (WebAPIException e) { } catch (WebAPIException e) {
attemptConnection(); attemptConnection();
cacheAnalysisHtml(); cacheAnalysisHtml(html);
} }
} else { } else {
PageCache.cachePage("analysisPage:" + Plan.getServerUUID(), () -> new AnalysisPageResponse(html)); PageCache.cachePage("analysisPage:" + Plan.getServerUUID(), () -> new AnalysisPageResponse(html));
@ -320,7 +337,11 @@ public class BukkitInformationManager extends InformationManager {
if (usingAnotherWebServer) { if (usingAnotherWebServer) {
try { try {
getWebAPI().getAPI(PostNetworkPageContentWebAPI.class).sendNetworkContent(webServerAddress, HtmlStructure.createServerContainer(plugin)); getWebAPI().getAPI(PostNetworkPageContentWebAPI.class).sendNetworkContent(webServerAddress, HtmlStructure.createServerContainer(plugin));
} catch (WebAPIForbiddenException ignored) {
/* Do nothing */
} catch (WebAPIException ignored) { } catch (WebAPIException ignored) {
attemptConnection();
updateNetworkPageContent();
} }
} }
} }