From fa954ab717a6c5da28c4f8034df3250576645a9e Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Mon, 25 May 2020 09:38:22 -0400 Subject: [PATCH] Confine preconnect validation/setup logic to event loop. --- .../proxy/connection/client/ConnectedPlayer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java index fd6b9d71c..49ebc529a 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java @@ -733,7 +733,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { // Otherwise, initiate the connection. ServerPreConnectEvent event = new ServerPreConnectEvent(ConnectedPlayer.this, toConnect); return server.getEventManager().fire(event) - .thenCompose(newEvent -> { + .thenComposeAsync(newEvent -> { Optional connectTo = newEvent.getResult().getServer(); if (!connectTo.isPresent()) { return CompletableFuture.completedFuture( @@ -754,7 +754,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { server); connectionInFlight = con; return con.connect(); - }); + }, connection.eventLoop()); } @Override