geforkt von Mirrors/Velocity
Add a new loginstatus for CANCELLED_BY_USER_BEFORE_COMPLETE
Dieser Commit ist enthalten in:
Ursprung
4c1db86760
Commit
079b352c97
@ -58,6 +58,7 @@ public final class DisconnectEvent {
|
||||
SUCCESSFUL_LOGIN,
|
||||
CONFLICTING_LOGIN,
|
||||
CANCELLED_BY_USER,
|
||||
CANCELLED_BY_PROXY
|
||||
CANCELLED_BY_PROXY,
|
||||
CANCELLED_BY_USER_BEFORE_COMPLETE
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,8 @@ import static com.velocitypowered.proxy.util.EncryptionUtils.decryptRsa;
|
||||
import static com.velocitypowered.proxy.util.EncryptionUtils.generateServerId;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.velocitypowered.api.event.connection.DisconnectEvent;
|
||||
import com.velocitypowered.api.event.connection.DisconnectEvent.LoginStatus;
|
||||
import com.velocitypowered.api.event.connection.LoginEvent;
|
||||
import com.velocitypowered.api.event.connection.PostLoginEvent;
|
||||
import com.velocitypowered.api.event.connection.PreLoginEvent;
|
||||
@ -224,13 +226,13 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
||||
if (!mcConnection.isClosed()) {
|
||||
// wait for permissions to load, then set the players permission function
|
||||
player.setPermissionFunction(event.createFunction(player));
|
||||
finishLogin(player);
|
||||
completeLoginProtocolPhaseAndInitialize(player);
|
||||
}
|
||||
}, mcConnection.eventLoop());
|
||||
});
|
||||
}
|
||||
|
||||
private void finishLogin(ConnectedPlayer player) {
|
||||
private void completeLoginProtocolPhaseAndInitialize(ConnectedPlayer player) {
|
||||
int threshold = server.getConfiguration().getCompressionThreshold();
|
||||
if (threshold >= 0 && mcConnection.getProtocolVersion().compareTo(MINECRAFT_1_8) >= 0) {
|
||||
mcConnection.write(new SetCompression(threshold));
|
||||
@ -253,6 +255,8 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
||||
.thenAcceptAsync(event -> {
|
||||
if (mcConnection.isClosed()) {
|
||||
// The player was disconnected
|
||||
server.getEventManager().fireAndForget(new DisconnectEvent(player,
|
||||
LoginStatus.CANCELLED_BY_USER_BEFORE_COMPLETE));
|
||||
return;
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren