[Fix] Velocity checks where Bungee presence is checked.

This commit is contained in:
Rsl1122 2018-10-14 11:51:28 +03:00
parent 6b58e902e6
commit 9acd4879ba
10 changed files with 18 additions and 15 deletions

View File

@ -65,6 +65,7 @@
<exclude>org.mockito:*</exclude>
<exclude>org.easymock:*</exclude>
<exclude>junit:*</exclude>
<exclued>org.slf4j:*</exclued>
</excludes>
</artifactSet>
<relocations>
@ -87,10 +88,6 @@
<pattern>com.zaxxer</pattern>
<shadedPattern>plan.com.zaxxer</shadedPattern>
</relocation>
<relocation>
<pattern>org.slf4j</pattern>
<shadedPattern>plan.org.slf4j</shadedPattern>
</relocation>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>com.djrapitops.plan.utilities.metrics</shadedPattern>

View File

@ -65,7 +65,7 @@ public class ManageConDebugCommand extends CommandNode {
this.webServer = webServer;
this.dbSystem = dbSystem;
setShortHelp(locale.getString(Check.isBungeeAvailable() ? CmdHelpLang.CON : CmdHelpLang.MANAGE_CON));
setShortHelp(locale.getString(Check.isBungeeAvailable() || Check.isVelocityAvailable() ? CmdHelpLang.CON : CmdHelpLang.MANAGE_CON));
setInDepthHelp(locale.getArray(DeepHelpLang.MANAGE_CON));
}

View File

@ -121,7 +121,7 @@ public class NetworkContainer extends DataContainer {
putSupplier(NetworkKeys.TIME_ZONE, config::getTimeZoneOffsetHours);
putCachingSupplier(NetworkKeys.NETWORK_NAME, () ->
Check.isBungeeAvailable() ?
Check.isBungeeAvailable() || Check.isVelocityAvailable() ?
config.getString(Settings.BUNGEE_NETWORK_NAME) :
bungeeContainer.getValue(ServerKeys.NAME).orElse("Plan")
);

View File

@ -150,6 +150,9 @@ public abstract class InfoSystem implements SubSystem {
if (Check.isBungeeAvailable()) {
throw new BadRequestException("Method not available on Bungee.");
}
if (Check.isVelocityAvailable()) {
throw new BadRequestException("Method not available on Velocity.");
}
Server bungee = new Server(-1, null, "Bungee", addressToRequestServer, -1);
String addressOfThisServer = webServer.get().getAccessAddress();

View File

@ -48,7 +48,7 @@ public class CheckConnectionRequest extends InfoRequestWithVariables {
public Response handleRequest(Map<String, String> variables) throws WebException {
// Available variables: sender, address
if (Check.isBungeeAvailable()) {
if (Check.isBungeeAvailable() || Check.isVelocityAvailable()) {
attemptConnection(variables);
}

View File

@ -65,6 +65,9 @@ public class SaveDBSettingsRequest extends InfoRequestWithVariables implements S
if (Check.isBungeeAvailable()) {
return new BadRequestResponse("Not supposed to be called on a Bungee server");
}
if (Check.isVelocityAvailable()) {
return new BadRequestResponse("Not supposed to be called on a Velocity server");
}
if (config.isFalse(Settings.BUNGEE_COPY_CONFIG) || config.isTrue(Settings.BUNGEE_OVERRIDE_STANDALONE_MODE)) {
return new BadRequestResponse("Bungee config settings overridden on this server.");
}

View File

@ -67,7 +67,7 @@ public class NetworkSettings {
}
public void loadSettingsFromDB() {
if (Check.isBungeeAvailable()) {
if (Check.isBungeeAvailable() || Check.isVelocityAvailable()) {
return;
}
@ -81,7 +81,7 @@ public class NetworkSettings {
}
public void placeSettingsToDB() {
if (!Check.isBungeeAvailable()) {
if (!Check.isBungeeAvailable() && !Check.isVelocityAvailable()) {
return;
}

View File

@ -82,7 +82,7 @@ public class WebServer implements SubSystem {
initServer();
if (!isEnabled()) {
if (Check.isBungeeAvailable()) {
if (Check.isBungeeAvailable() || Check.isVelocityAvailable()) {
throw new EnableException(locale.getString(PluginLang.ENABLE_FAIL_NO_WEB_SERVER_BUNGEE));
}
if (config.isTrue(Settings.WEBSERVER_DISABLED)) {
@ -99,7 +99,7 @@ public class WebServer implements SubSystem {
* Starts up the WebServer in a new Thread Pool.
*/
private void initServer() {
if (!Check.isBungeeAvailable() && config.isTrue(Settings.WEBSERVER_DISABLED)) {
if (!(Check.isBungeeAvailable() || Check.isVelocityAvailable()) && config.isTrue(Settings.WEBSERVER_DISABLED)) {
// Bukkit WebServer has been disabled.
return;
}

View File

@ -69,7 +69,7 @@ public class ServerPageHandler implements PageHandler {
if (response != null) {
return response;
} else {
if (Check.isBungeeAvailable() && serverInfo.getServerUUID().equals(serverUUID)) {
if ((Check.isBungeeAvailable() || Check.isVelocityAvailable()) && serverInfo.getServerUUID().equals(serverUUID)) {
return ResponseCache.loadResponse(PageId.SERVER.of(serverUUID), responseFactory::networkPageResponse);
}
return refreshNow(serverUUID);

View File

@ -34,7 +34,7 @@ public abstract class SpecificExport implements Runnable {
private final ServerInfo serverInfo;
protected final File outputFolder;
private final boolean usingBungee;
private final boolean usingProxy;
protected SpecificExport(
PlanFiles files,
@ -45,7 +45,7 @@ public abstract class SpecificExport implements Runnable {
this.config = config;
this.serverInfo = serverInfo;
outputFolder = getFolder();
usingBungee = Check.isBungeeAvailable();
usingProxy = Check.isBungeeAvailable() || Check.isVelocityAvailable();
}
protected File getFolder() {
@ -112,7 +112,7 @@ public abstract class SpecificExport implements Runnable {
.replace("src=\"js/", "src=\"../js/");
File htmlLocation;
if (usingBungee) {
if (usingProxy) {
if (serverUUID.equals(serverInfo.getServerUUID())) {
htmlLocation = new File(outputFolder, "network");
} else {