13
0
geforkt von Mirrors/Velocity

Simplify and fix bug in setConnectedServer()

Also, while I'm here, fix a typo from a recent PR.
Dieser Commit ist enthalten in:
Andrew Steinborn 2018-10-29 02:58:29 -04:00
Ursprung 826eddc754
Commit 2b53d14461
3 geänderte Dateien mit 4 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -211,7 +211,7 @@ public abstract class AnnotatedConfig {
return key;
}
protected static String unesacpeKeyIfNeeded(String key) {
protected static String unescapeKeyIfNeeded(String key) {
int lastIndex;
if (key.indexOf('"') == 0 && (lastIndex = key.lastIndexOf('"')) == (key.length() - 1)) {
return key.substring(1, lastIndex);

Datei anzeigen

@ -487,9 +487,9 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi
for (Map.Entry<String, Object> entry : toml.entrySet()) {
if (entry.getValue() instanceof String) {
forcedHosts
.put(unesacpeKeyIfNeeded(entry.getKey()), ImmutableList.of((String) entry.getValue()));
.put(unescapeKeyIfNeeded(entry.getKey()), ImmutableList.of((String) entry.getValue()));
} else if (entry.getValue() instanceof List) {
forcedHosts.put(unesacpeKeyIfNeeded(entry.getKey()),
forcedHosts.put(unescapeKeyIfNeeded(entry.getKey()),
ImmutableList.copyOf((List<String>) entry.getValue()));
} else {
throw new IllegalStateException(

Datei anzeigen

@ -444,16 +444,9 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
}
public void setConnectedServer(@Nullable VelocityServerConnection serverConnection) {
VelocityServerConnection oldConnection = this.connectedServer;
this.connectedServer = serverConnection;
this.tryIndex = 0; // reset since we got connected to a server
if (serverConnection == null) {
return;
}
if (oldConnection != null && !serverConnection.getServerInfo()
.equals(oldConnection.getServerInfo())) {
this.tryIndex = 0;
}
if (serverConnection == connectionInFlight) {
connectionInFlight = null;
}