From e8715e5399f726bcaa9a56630548ef4d623c1e14 Mon Sep 17 00:00:00 2001 From: mohammed jasem alaajel Date: Tue, 14 May 2024 19:23:09 +0400 Subject: [PATCH] ignore IllegalStateException thrown by ServerConnection class in velocity --- .../minecraft/redisbungee/RedisBungeeListener.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java b/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java index 05e9264..b0ac059 100644 --- a/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java +++ b/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java @@ -26,7 +26,6 @@ import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.ServerConnection; import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.ServerPing; -import net.kyori.adventure.text.Component; import java.util.*; import java.util.stream.Collectors; @@ -146,8 +145,11 @@ public class RedisBungeeListener { return; } } - - ((ServerConnection) event.getSource()).sendPluginMessage(event.getIdentifier(), out.toByteArray()); + try { + // ServerConnection throws IllegalStateException when connection dies somehow so just ignore :/ + ((ServerConnection) event.getSource()).sendPluginMessage(event.getIdentifier(), out.toByteArray()); + } catch (IllegalStateException ignored) { + } }); }