Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-24 15:20:35 +01:00
Merge pull request #274 from Crypnotic/bugfix/invalid-server-key
Clean server name keys before attempting to register
Dieser Commit ist enthalten in:
Commit
c0ef3edcc4
@ -467,7 +467,7 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi
|
|||||||
Map<String, String> servers = new HashMap<>();
|
Map<String, String> servers = new HashMap<>();
|
||||||
for (Map.Entry<String, Object> entry : toml.entrySet()) {
|
for (Map.Entry<String, Object> entry : toml.entrySet()) {
|
||||||
if (entry.getValue() instanceof String) {
|
if (entry.getValue() instanceof String) {
|
||||||
servers.put(entry.getKey(), (String) entry.getValue());
|
servers.put(cleanServerName(entry.getKey()), (String) entry.getValue());
|
||||||
} else {
|
} else {
|
||||||
if (!entry.getKey().equalsIgnoreCase("try")) {
|
if (!entry.getKey().equalsIgnoreCase("try")) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
@ -501,6 +501,19 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi
|
|||||||
this.attemptConnectionOrder = attemptConnectionOrder;
|
this.attemptConnectionOrder = attemptConnectionOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TOML requires keys to match a regex of {@code [A-Za-z0-9_-]} unless it is wrapped in
|
||||||
|
* quotes; however, the TOML parser returns the key with the quotes so we need to clean the
|
||||||
|
* server name before we pass it onto server registration to keep proper server name behavior.
|
||||||
|
*
|
||||||
|
* @param name the server name to clean
|
||||||
|
*
|
||||||
|
* @return the cleaned server name
|
||||||
|
*/
|
||||||
|
private String cleanServerName(String name) {
|
||||||
|
return name.replace("\"", "");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Servers{"
|
return "Servers{"
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren