Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 05:20:14 +01:00
Fix one more case of a possibly swallowed exception (#455)
Maybe spotbugs will add a rule for this in the future
Dieser Commit ist enthalten in:
Ursprung
be21ac5a30
Commit
7ba2318506
@ -309,7 +309,11 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
|||||||
|
|
||||||
mcConnection.setSessionHandler(new InitialConnectSessionHandler(player));
|
mcConnection.setSessionHandler(new InitialConnectSessionHandler(player));
|
||||||
server.getEventManager().fire(new PostLoginEvent(player))
|
server.getEventManager().fire(new PostLoginEvent(player))
|
||||||
.thenRun(() -> connectToInitialServer(player));
|
.thenCompose((ignored) -> connectToInitialServer(player))
|
||||||
|
.exceptionally((ex) -> {
|
||||||
|
logger.error("Exception while connecting {} to initial server", player, ex);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, mcConnection.eventLoop())
|
}, mcConnection.eventLoop())
|
||||||
.exceptionally((ex) -> {
|
.exceptionally((ex) -> {
|
||||||
@ -318,12 +322,12 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void connectToInitialServer(ConnectedPlayer player) {
|
private CompletableFuture<Void> connectToInitialServer(ConnectedPlayer player) {
|
||||||
Optional<RegisteredServer> initialFromConfig = player.getNextServerToTry();
|
Optional<RegisteredServer> initialFromConfig = player.getNextServerToTry();
|
||||||
PlayerChooseInitialServerEvent event = new PlayerChooseInitialServerEvent(player,
|
PlayerChooseInitialServerEvent event = new PlayerChooseInitialServerEvent(player,
|
||||||
initialFromConfig.orElse(null));
|
initialFromConfig.orElse(null));
|
||||||
|
|
||||||
server.getEventManager().fire(event)
|
return server.getEventManager().fire(event)
|
||||||
.thenRunAsync(() -> {
|
.thenRunAsync(() -> {
|
||||||
Optional<RegisteredServer> toTry = event.getInitialServer();
|
Optional<RegisteredServer> toTry = event.getInitialServer();
|
||||||
if (!toTry.isPresent()) {
|
if (!toTry.isPresent()) {
|
||||||
@ -332,11 +336,7 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.createConnectionRequest(toTry.get()).fireAndForget();
|
player.createConnectionRequest(toTry.get()).fireAndForget();
|
||||||
}, mcConnection.eventLoop())
|
}, mcConnection.eventLoop());
|
||||||
.exceptionally((ex) -> {
|
|
||||||
logger.error("Exception while connecting {} to initial server", player, ex);
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren