geforkt von Mirrors/Velocity
Merge branch 'dev/1.1.0' into decode-multiple
Dieser Commit ist enthalten in:
Commit
a15c8ecc2b
@ -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
|
||||||
+ '}';
|
+ '}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren