From 75ddeb062f8b114453f98c00d81b82b21f955312 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