Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-24 15:20:35 +01:00
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,
|
SUCCESSFUL_LOGIN,
|
||||||
CONFLICTING_LOGIN,
|
CONFLICTING_LOGIN,
|
||||||
CANCELLED_BY_USER,
|
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 static com.velocitypowered.proxy.util.EncryptionUtils.generateServerId;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
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.LoginEvent;
|
||||||
import com.velocitypowered.api.event.connection.PostLoginEvent;
|
import com.velocitypowered.api.event.connection.PostLoginEvent;
|
||||||
import com.velocitypowered.api.event.connection.PreLoginEvent;
|
import com.velocitypowered.api.event.connection.PreLoginEvent;
|
||||||
@ -224,13 +226,13 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
|||||||
if (!mcConnection.isClosed()) {
|
if (!mcConnection.isClosed()) {
|
||||||
// wait for permissions to load, then set the players permission function
|
// wait for permissions to load, then set the players permission function
|
||||||
player.setPermissionFunction(event.createFunction(player));
|
player.setPermissionFunction(event.createFunction(player));
|
||||||
finishLogin(player);
|
completeLoginProtocolPhaseAndInitialize(player);
|
||||||
}
|
}
|
||||||
}, mcConnection.eventLoop());
|
}, mcConnection.eventLoop());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void finishLogin(ConnectedPlayer player) {
|
private void completeLoginProtocolPhaseAndInitialize(ConnectedPlayer player) {
|
||||||
int threshold = server.getConfiguration().getCompressionThreshold();
|
int threshold = server.getConfiguration().getCompressionThreshold();
|
||||||
if (threshold >= 0 && mcConnection.getProtocolVersion().compareTo(MINECRAFT_1_8) >= 0) {
|
if (threshold >= 0 && mcConnection.getProtocolVersion().compareTo(MINECRAFT_1_8) >= 0) {
|
||||||
mcConnection.write(new SetCompression(threshold));
|
mcConnection.write(new SetCompression(threshold));
|
||||||
@ -253,6 +255,8 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
|||||||
.thenAcceptAsync(event -> {
|
.thenAcceptAsync(event -> {
|
||||||
if (mcConnection.isClosed()) {
|
if (mcConnection.isClosed()) {
|
||||||
// The player was disconnected
|
// The player was disconnected
|
||||||
|
server.getEventManager().fireAndForget(new DisconnectEvent(player,
|
||||||
|
LoginStatus.CANCELLED_BY_USER_BEFORE_COMPLETE));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren