JnCrMx / discord-game-sdk4j

Java bindings for Discord's Game SDK
MIT License
114 stars 23 forks source link

Failure completly kills application #70

Closed n1klas4008 closed 11 months ago

n1klas4008 commented 11 months ago

I have added this library to a project of mine and for a user on Linux Mint he gets this error message (presumably german)

gio: discord:///library/1147927098497957940/launch: Der angegebene Ort wird nicht unterstützt

Is it intentional for the whole application to get killed when this happens, I would assume RPC just would not connect/start/display while the application remains running but this just completly terminates Java

Discord was installed via Flatpack not sure if this makes a difference but adding this for context

JnCrMx commented 11 months ago

Hi,

it is intentional behavior of the underlying native library to terminate the application if Discord is not running (and it will then try to relaunch the application via Discord). I do not completely understand why Discord decided to do it like that (and imho a hard call to exit(3) in a library code is very bad practice), but that is just how the library behaves.

However, you can disable this behavior by using CreateParams.Flags.NO_REQUIRE_DISCORD in the CreateParams when creating the Core. See my comment on #30 for more details.

You can also try using the new java-impl branch (which does not have this behavior and should also work better with Discord running with Flatpak).

I hope this helps :D

n1klas4008 commented 11 months ago

thanks alot for the quick response, will alter Core accordingly - might also switch the branch but what are the differences to java-impl?

JnCrMx commented 11 months ago

The java-impl branch reimplements the entire functionality of the SDK's native library (the underlying protocol is quite simple).

It does not support Networking and stuff like that, but this functionality was removed by Discord (sadly) anyway. Besides that it is almost feature complete (except getCurrentUserPremiumType() in UserManager, because I could not figure out how to implement that).

The advantages of this branch are that it does not require you to download/ship Discord's native library and that it should support Flatpak and Snap installations of Discord (which afaik Discord's native library does not). It also does not include weird behavior like closing your app if Discord is not running ;)