13
0
geforkt von Mirrors/Velocity

Enhance config checks.

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-09-04 01:37:08 -04:00
Ursprung d2133bf0b4
Commit 5e0b13edcd

Datei anzeigen

@ -103,14 +103,14 @@ public class VelocityConfiguration extends AnnotatedConfig {
if (bind.isEmpty()) { if (bind.isEmpty()) {
logger.error("'bind' option is empty."); logger.error("'bind' option is empty.");
valid = false; valid = false;
} } else {
try { try {
AddressUtil.parseAddress(bind); AddressUtil.parseAddress(bind);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
logger.error("'bind' option does not specify a valid IP address.", e); logger.error("'bind' option does not specify a valid IP address.", e);
valid = false; valid = false;
} }
}
if (!onlineMode) { if (!onlineMode) {
logger.info("Proxy is running in offline mode!"); logger.info("Proxy is running in offline mode!");
@ -118,11 +118,11 @@ public class VelocityConfiguration extends AnnotatedConfig {
switch (playerInfoForwardingMode) { switch (playerInfoForwardingMode) {
case NONE: case NONE:
logger.info("Player info forwarding is disabled! All players will appear to be connecting from the proxy and will have offline-mode UUIDs."); logger.warn("Player info forwarding is disabled! All players will appear to be connecting from the proxy and will have offline-mode UUIDs.");
break; break;
case MODERN: case MODERN:
if (forwardingSecret.length == 0) { if (forwardingSecret == null || forwardingSecret.length == 0) {
logger.error("You don't have a forwarding secret set."); logger.error("You don't have a forwarding secret set. This is required for security.");
valid = false; valid = false;
} }
break; break;
@ -148,7 +148,7 @@ public class VelocityConfiguration extends AnnotatedConfig {
for (String s : servers.getAttemptConnectionOrder()) { for (String s : servers.getAttemptConnectionOrder()) {
if (!servers.getServers().containsKey(s)) { if (!servers.getServers().containsKey(s)) {
logger.error("Fallback server " + s + " doesn't exist!"); logger.error("Fallback server " + s + " is not registered in your configuration!");
valid = false; valid = false;
} }
} }
@ -165,18 +165,18 @@ public class VelocityConfiguration extends AnnotatedConfig {
logger.error("Invalid compression level {}", advanced.compressionLevel); logger.error("Invalid compression level {}", advanced.compressionLevel);
valid = false; valid = false;
} else if (advanced.compressionLevel == 0) { } else if (advanced.compressionLevel == 0) {
logger.warn("ALL packets going through the proxy are going to be uncompressed. This will increase bandwidth usage."); logger.warn("ALL packets going through the proxy will be uncompressed. This will increase bandwidth usage.");
} }
if (advanced.compressionThreshold < -1) { if (advanced.compressionThreshold < -1) {
logger.error("Invalid compression threshold {}", advanced.compressionLevel); logger.error("Invalid compression threshold {}", advanced.compressionLevel);
valid = false; valid = false;
} else if (advanced.compressionThreshold == 0) { } else if (advanced.compressionThreshold == 0) {
logger.warn("ALL packets going through the proxy are going to be compressed. This may hurt performance."); logger.warn("ALL packets going through the proxy will be compressed. This will compromise throughput and increase CPU usage!");
} }
if (advanced.loginRatelimit < 0) { if (advanced.loginRatelimit < 0) {
logger.error("Invalid login ratelimit {}", advanced.loginRatelimit); logger.error("Invalid login ratelimit {}ms", advanced.loginRatelimit);
valid = false; valid = false;
} }
@ -217,7 +217,7 @@ public class VelocityConfiguration extends AnnotatedConfig {
if (motd.startsWith("{")) { if (motd.startsWith("{")) {
motdAsComponent = ComponentSerializers.JSON.deserialize(motd); motdAsComponent = ComponentSerializers.JSON.deserialize(motd);
} else { } else {
motdAsComponent = ComponentSerializers.LEGACY.deserialize(LegacyChatColorUtils.translate('&', motd)); motdAsComponent = ComponentSerializers.LEGACY.deserialize(motd, '&');
} }
} }
return motdAsComponent; return motdAsComponent;