Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 05:20:14 +01:00
Move registration to be performed earlier.
Dieser Commit ist enthalten in:
Ursprung
866067bbed
Commit
d1473ed938
@ -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));
|
||||
|
@ -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),
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren