MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / invitePlayer

Method invitePlayer

source/game/StarTeamClient.cpp:44–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44void TeamClient::invitePlayer(String const& playerName) {
45 if (playerName.empty())
46 return;
47
48 JsonObject request;
49 request["inviteeName"] = playerName;
50 request["inviterUuid"] = m_clientContext->playerUuid().hex();
51 request["inviterName"] = m_mainPlayer->name();
52 invokeRemote("team.invite", request, [=](Json response) {
53 if (!response)
54 m_pendingInviteResults.append(make_pair(playerName, true));
55 else if (response == "inviteeNotFound")
56 m_pendingInviteResults.append(make_pair(playerName, false));
57 else if (response.isType(Json::Type::Array)) {
58 m_pendingInviteResults.push_back(StringList());
59 StringList& invited = m_pendingInviteResults.back().get<StringList>();
60 for (auto& entry : response.toArray()) {
61 if (!entry.isType(Json::Type::Array))
62 continue;
63 auto name = entry.get(0, Json());
64 if (name.isType(Json::Type::String))
65 invited.append(name.toString());
66 }
67 }
68 });
69}
70
71void TeamClient::acceptInvitation(Uuid const& inviterUuid) {
72 JsonObject request;

Callers

nothing calls this directly

Calls 13

StringListClass · 0.85
JsonClass · 0.85
hexMethod · 0.80
playerUuidMethod · 0.80
toArrayMethod · 0.80
emptyMethod · 0.45
nameMethod · 0.45
appendMethod · 0.45
isTypeMethod · 0.45
push_backMethod · 0.45
backMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected