3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 13:30:17 +01:00

Move registration to be performed earlier.

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-11-17 00:04:44 -05:00
Ursprung 866067bbed
Commit d1473ed938
2 geänderte Dateien mit 8 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -40,6 +40,7 @@ import java.security.GeneralSecurityException;
import java.security.KeyPair; import java.security.KeyPair;
import java.util.Arrays; import java.util.Arrays;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import net.kyori.text.Component; import net.kyori.text.Component;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
@ -228,6 +229,11 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
apiInbound.getVirtualHost().orElse(null)); apiInbound.getVirtualHost().orElse(null));
this.connectedPlayer = player; this.connectedPlayer = player;
if (!server.registerConnection(player)) {
player.disconnect(VelocityMessages.ALREADY_CONNECTED);
return CompletableFuture.completedFuture(null);
}
return server.getEventManager() return server.getEventManager()
.fire(new PermissionsSetupEvent(player, ConnectedPlayer.DEFAULT_PERMISSIONS)) .fire(new PermissionsSetupEvent(player, ConnectedPlayer.DEFAULT_PERMISSIONS))
.thenCompose(event -> { .thenCompose(event -> {
@ -261,11 +267,6 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
return; return;
} }
if (!server.registerConnection(player)) {
player.disconnect(VelocityMessages.ALREADY_CONNECTED);
return;
}
int threshold = server.getConfiguration().getCompressionThreshold(); int threshold = server.getConfiguration().getCompressionThreshold();
if (threshold >= 0) { if (threshold >= 0) {
inbound.write(new SetCompression(threshold)); inbound.write(new SetCompression(threshold));

Datei anzeigen

@ -38,9 +38,8 @@ public class StatusSessionHandler implements MinecraftSessionHandler {
public boolean handle(StatusRequest packet) { public boolean handle(StatusRequest packet) {
VelocityConfiguration configuration = server.getConfiguration(); VelocityConfiguration configuration = server.getConfiguration();
int shownVersion = ProtocolConstants.isSupported(connection.getProtocolVersion()) ? connection int shownVersion = ProtocolConstants.isSupported(connection.getProtocolVersion())
.getProtocolVersion() : ? connection.getProtocolVersion() : ProtocolConstants.MAXIMUM_GENERIC_VERSION;
ProtocolConstants.MAXIMUM_GENERIC_VERSION;
ServerPing initialPing = new ServerPing( ServerPing initialPing = new ServerPing(
new ServerPing.Version(shownVersion, new ServerPing.Version(shownVersion,
"Velocity " + ProtocolConstants.SUPPORTED_GENERIC_VERSION_STRING), "Velocity " + ProtocolConstants.SUPPORTED_GENERIC_VERSION_STRING),