geforkt von Mirrors/Velocity
Fix coding error that caused players to time out if moving to another server fails
Thanks to @Gabik21 for noticing this bug.
Dieser Commit ist enthalten in:
Ursprung
764c8ed3e5
Commit
5a26b4e03d
@ -573,16 +573,21 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
}
|
}
|
||||||
KickedFromServerEvent originalEvent = new KickedFromServerEvent(this, rs, kickReason,
|
KickedFromServerEvent originalEvent = new KickedFromServerEvent(this, rs, kickReason,
|
||||||
!kickedFromCurrent, result);
|
!kickedFromCurrent, result);
|
||||||
handleKickEvent(originalEvent, friendlyReason);
|
handleKickEvent(originalEvent, friendlyReason, kickedFromCurrent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleKickEvent(KickedFromServerEvent originalEvent, Component friendlyReason) {
|
private void handleKickEvent(KickedFromServerEvent originalEvent, Component friendlyReason,
|
||||||
|
boolean kickedFromCurrent) {
|
||||||
server.getEventManager().fire(originalEvent)
|
server.getEventManager().fire(originalEvent)
|
||||||
.thenAcceptAsync(event -> {
|
.thenAcceptAsync(event -> {
|
||||||
// There can't be any connection in flight now.
|
// There can't be any connection in flight now.
|
||||||
connectionInFlight = null;
|
connectionInFlight = null;
|
||||||
|
|
||||||
// Make sure we clear the current connected server as the connection is invalid.
|
// Make sure we clear the current connected server as the connection is invalid.
|
||||||
|
boolean previouslyConnected = connectedServer != null;
|
||||||
|
if (kickedFromCurrent) {
|
||||||
connectedServer = null;
|
connectedServer = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isActive()) {
|
if (!isActive()) {
|
||||||
// If the connection is no longer active, it makes no sense to try and recover it.
|
// If the connection is no longer active, it makes no sense to try and recover it.
|
||||||
@ -628,7 +633,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
}, connection.eventLoop());
|
}, connection.eventLoop());
|
||||||
} else if (event.getResult() instanceof Notify) {
|
} else if (event.getResult() instanceof Notify) {
|
||||||
Notify res = (Notify) event.getResult();
|
Notify res = (Notify) event.getResult();
|
||||||
if (event.kickedDuringServerConnect()) {
|
if (event.kickedDuringServerConnect() && previouslyConnected) {
|
||||||
sendMessage(res.getMessageComponent());
|
sendMessage(res.getMessageComponent());
|
||||||
} else {
|
} else {
|
||||||
disconnect(res.getMessageComponent());
|
disconnect(res.getMessageComponent());
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren