Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-16 21:10:30 +01:00
Add DisconnectEvent#disconnectedDuringLogin()
Dieser Commit ist enthalten in:
Ursprung
4c09024952
Commit
fb0446f4fc
@ -10,19 +10,31 @@ import com.velocitypowered.api.proxy.Player;
|
||||
public final class DisconnectEvent {
|
||||
|
||||
private final Player player;
|
||||
private final boolean disconnectedDuringLogin;
|
||||
|
||||
public DisconnectEvent(Player player) {
|
||||
this(player, false);
|
||||
}
|
||||
|
||||
public DisconnectEvent(Player player,
|
||||
boolean disconnectedDuringLogin) {
|
||||
this.player = Preconditions.checkNotNull(player, "player");
|
||||
this.disconnectedDuringLogin = disconnectedDuringLogin;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public boolean disconnectedDuringLogin() {
|
||||
return this.disconnectedDuringLogin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DisconnectEvent{"
|
||||
+ "player=" + player
|
||||
+ "player=" + player + ", "
|
||||
+ "disconnectedDuringLogin=" + disconnectedDuringLogin
|
||||
+ '}';
|
||||
}
|
||||
}
|
||||
|
@ -571,8 +571,10 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
||||
if (connectedServer != null) {
|
||||
connectedServer.disconnect();
|
||||
}
|
||||
boolean isConnected = server.getPlayer(this.getUniqueId()).isPresent();
|
||||
|
||||
server.unregisterConnection(this);
|
||||
server.getEventManager().fire(new DisconnectEvent(this))
|
||||
server.getEventManager().fire(new DisconnectEvent(this, !isConnected))
|
||||
.thenRun(() -> this.teardownFuture.complete(null));
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren