From c2a6548d7b95cd7bf53c1bbf070f3a61278f2318 Mon Sep 17 00:00:00 2001 From: Aust1n46 Date: Sun, 29 Aug 2021 02:02:21 -0400 Subject: [PATCH] Hotfix for /msg tab completion on Velocity. --- pom.xml | 2 +- .../Aust1n46/chat/proxy/VentureChatVelocity.java | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index caa00ca..40992ee 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 mineverse.Aust1n46.chat VentureChat - 3.1.0 + 3.1.1 https://bitbucket.org/Aust1n46/venturechat/src/master https://bitbucket.org/Aust1n46/venturechat/src/master diff --git a/src/main/java/mineverse/Aust1n46/chat/proxy/VentureChatVelocity.java b/src/main/java/mineverse/Aust1n46/chat/proxy/VentureChatVelocity.java index 6653bc0..f661ef5 100644 --- a/src/main/java/mineverse/Aust1n46/chat/proxy/VentureChatVelocity.java +++ b/src/main/java/mineverse/Aust1n46/chat/proxy/VentureChatVelocity.java @@ -8,6 +8,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.List; import java.util.Optional; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import org.slf4j.Logger; @@ -96,7 +97,12 @@ public class VentureChatVelocity implements VentureChatProxySource { @Subscribe public void onPlayerQuit(DisconnectEvent event) { - updatePlayerNames(); + // Delay sending plugin message to make sure disconnecting player is truly disconnected. + proxyServer.getScheduler().buildTask(this, () -> { + updatePlayerNames(); + }) + .delay(1, TimeUnit.SECONDS) + .schedule(); } private void updatePlayerNames() { @@ -112,7 +118,7 @@ public class VentureChatVelocity implements VentureChatProxySource { if(!send.isEmpty()) { sendPluginMessage(send.getName(), outstream.toByteArray()); } - }); + }); } catch(IllegalStateException e) { sendConsoleMessage("Velocity being finicky with DisconnectEvent.");