Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-24 23:30:26 +01:00
Enhance config checks.
Dieser Commit ist enthalten in:
Ursprung
d2133bf0b4
Commit
5e0b13edcd
@ -103,13 +103,13 @@ 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) {
|
||||||
@ -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;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren