3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-23 23:00:35 +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.util.Arrays;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadLocalRandom;
import net.kyori.text.Component;
import org.apache.logging.log4j.LogManager;
@ -228,6 +229,11 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
apiInbound.getVirtualHost().orElse(null));
this.connectedPlayer = player;
if (!server.registerConnection(player)) {
player.disconnect(VelocityMessages.ALREADY_CONNECTED);
return CompletableFuture.completedFuture(null);
}
return server.getEventManager()
.fire(new PermissionsSetupEvent(player, ConnectedPlayer.DEFAULT_PERMISSIONS))
.thenCompose(event -> {
@ -261,11 +267,6 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
return;
}
if (!server.registerConnection(player)) {
player.disconnect(VelocityMessages.ALREADY_CONNECTED);
return;
}
int threshold = server.getConfiguration().getCompressionThreshold();
if (threshold >= 0) {
inbound.write(new SetCompression(threshold));

Datei anzeigen

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