JnCrMx / discord-game-sdk4j

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

How to know when lobby search finishes? #27

Closed artemiswkearney closed 3 years ago

artemiswkearney commented 3 years ago

LobbyManager.search() calls DEFAULT_CALLBACK when the search finishes, but a bunch of other things also call it. There doesn't seem to be a Result specific to "your lobby search is done", so there's no way to tell whether the callback is related, as far as I can tell.

The C and C# versions of this function seem to take a callback as the second argument, but the Java version here only takes the query.

JnCrMx commented 3 years ago

There are to versions of the search-method:

The first one only exists for consistency, because I decided to implement a DEFAULT_CALLBACK version of all methods that have a callback. For search that version might be a little useless indeed.

artemiswkearney commented 3 years ago

Okay, I could've sworn the docs only showed the first version. It looks like what actually happened is that they showed the 1-argument version last, and I scrolled down looking for a solution but not up. (Also, all the mentions of search in the docs for the methods for interacting with the results link to the 1-argument version.) Closing the issue here, although maybe it's worth making those links point to the more useful one?

JnCrMx commented 3 years ago

Usually the two version link to each other, but in the case of search I made a mistake, so that search(LobbySearchQuery query) linked to itself, instead of to search(LobbySearchQuery query, Consumer<Result> callback).

But I will consider changing all links to search(LobbySearchQuery query) to links to search(LobbySearchQuery query, Consumer<Result> callback).