13
0
geforkt von Mirrors/Velocity

Merge branch 'dev/1.1.0' into decode-multiple

Dieser Commit ist enthalten in:
Andrew Steinborn 2019-12-31 21:43:11 -05:00
Commit a15c8ecc2b
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 { public final class DisconnectEvent {
private final Player player; private final Player player;
private final boolean disconnectedDuringLogin;
public DisconnectEvent(Player player) { public DisconnectEvent(Player player) {
this(player, false);
}
public DisconnectEvent(Player player,
boolean disconnectedDuringLogin) {
this.player = Preconditions.checkNotNull(player, "player"); this.player = Preconditions.checkNotNull(player, "player");
this.disconnectedDuringLogin = disconnectedDuringLogin;
} }
public Player getPlayer() { public Player getPlayer() {
return player; return player;
} }
public boolean disconnectedDuringLogin() {
return this.disconnectedDuringLogin;
}
@Override @Override
public String toString() { public String toString() {
return "DisconnectEvent{" return "DisconnectEvent{"
+ "player=" + player + "player=" + player + ", "
+ "disconnectedDuringLogin=" + disconnectedDuringLogin
+ '}'; + '}';
} }
} }

Datei anzeigen

@ -571,8 +571,10 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
if (connectedServer != null) { if (connectedServer != null) {
connectedServer.disconnect(); connectedServer.disconnect();
} }
boolean isConnected = server.getPlayer(this.getUniqueId()).isPresent();
server.unregisterConnection(this); server.unregisterConnection(this);
server.getEventManager().fire(new DisconnectEvent(this)) server.getEventManager().fire(new DisconnectEvent(this, !isConnected))
.thenRun(() -> this.teardownFuture.complete(null)); .thenRun(() -> this.teardownFuture.complete(null));
} }