3
0
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:
Andrew Steinborn 2019-12-24 23:56:39 -05:00
Ursprung 4c09024952
Commit fb0446f4fc
2 geänderte Dateien mit 16 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -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
+ '}';
}
}

Datei anzeigen

@ -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));
}