Hello!
I’m currently working on a Match system, like Among Us, where you enter a code to join a lobby. To do this I wanted to use the onMatchPresence Event call. I used the code of this documentation, but I get an ‘onMatchPresence’ overrides nothing error, when I try to compile.
Here’s the java code of the documentation:
@Override
public void onMatchPresence(MatchPresenceEvent e) {
if (e.getJoins() != null) {
e.getJoins().forEach(presence -> {
//joins
});
}
if (e.getLeaves() != null) {
e.getLeaves().forEach(presence -> {
if (players.containsKey(presence.getSessionId())) {
//leaves
}
});
}
}
And I converted the code to Kotlin:
override fun onMatchPresence(e: MatchPresenceEvent) {
if (e.joins != null) {
e.joins.forEach { presence ->
//joins
recview.addGuest(presence.userId, getDisplayName(presence.userId, presence.username))
}
}
if (e.leaves != null) {
e.leaves.forEach { presence ->
//leave
}
}
}
Should work the same but I get the error. Can anybody help me out here?
Nakama 3.13
Windows
Java SDK 2.1.4
!!
EDIT:
!!
I’ve now implemented them correctly, but still to not get callbacks when a user joins the lobby!
Does anybody know why this happens?