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:
Ursprung
826eddc754
Commit
2b53d14461
@ -211,7 +211,7 @@ public abstract class AnnotatedConfig {
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static String unesacpeKeyIfNeeded(String key) {
|
protected static String unescapeKeyIfNeeded(String key) {
|
||||||
int lastIndex;
|
int lastIndex;
|
||||||
if (key.indexOf('"') == 0 && (lastIndex = key.lastIndexOf('"')) == (key.length() - 1)) {
|
if (key.indexOf('"') == 0 && (lastIndex = key.lastIndexOf('"')) == (key.length() - 1)) {
|
||||||
return key.substring(1, lastIndex);
|
return key.substring(1, lastIndex);
|
||||||
|
@ -487,9 +487,9 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi
|
|||||||
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) {
|
||||||
forcedHosts
|
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) {
|
} else if (entry.getValue() instanceof List) {
|
||||||
forcedHosts.put(unesacpeKeyIfNeeded(entry.getKey()),
|
forcedHosts.put(unescapeKeyIfNeeded(entry.getKey()),
|
||||||
ImmutableList.copyOf((List<String>) entry.getValue()));
|
ImmutableList.copyOf((List<String>) entry.getValue()));
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
|
@ -444,16 +444,9 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setConnectedServer(@Nullable VelocityServerConnection serverConnection) {
|
public void setConnectedServer(@Nullable VelocityServerConnection serverConnection) {
|
||||||
VelocityServerConnection oldConnection = this.connectedServer;
|
|
||||||
this.connectedServer = serverConnection;
|
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) {
|
if (serverConnection == connectionInFlight) {
|
||||||
connectionInFlight = null;
|
connectionInFlight = null;
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren