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

Method kick

source/game/StarCommandProcessor.cpp:587–610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

585}
586
587String CommandProcessor::kick(ConnectionId connectionId, String const& argumentString) {
588 if (auto errorMsg = adminCheck(connectionId, "kick a user"))
589 return *errorMsg;
590
591 auto arguments = m_parser.tokenizeToStringList(argumentString);
592
593 if (arguments.empty())
594 return "No player specified";
595
596 auto toKick = playerCidFromCommand(arguments[0], m_universe);
597 if (!toKick)
598 return strf("No user with specifier {} found.", arguments[0]);
599
600 // Like IRC, if only the nick is passed then the nick is used as the reason
601 if (arguments.size() == 1)
602 arguments.append(m_universe->clientNick(*toKick));
603
604 m_universe->disconnectClient(*toKick, arguments[1]);
605
606 return strf("Successfully kicked user with specifier {}. ConnectionId: {}. Reason given: {}",
607 arguments[0],
608 toKick,
609 arguments[1]);
610}
611
612String CommandProcessor::ban(ConnectionId connectionId, String const& argumentString) {
613 if (auto errorMsg = adminCheck(connectionId, "ban a user"))

Callers

nothing calls this directly

Calls 7

strfFunction · 0.85
tokenizeToStringListMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
appendMethod · 0.45
clientNickMethod · 0.45
disconnectClientMethod · 0.45

Tested by

no test coverage detected