Skip to content

Commit

Permalink
ignore IllegalStateException thrown by ServerConnection class in velo…
Browse files Browse the repository at this point in the history
…city
  • Loading branch information
ham1255 committed May 14, 2024
1 parent 7128705 commit e8715e5
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
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;
Expand Down Expand Up @@ -146,8 +145,11 @@ public void onPluginMessage(PluginMessageEvent event) {
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) {
}
});

}
Expand Down

0 comments on commit e8715e5

Please sign in to comment.