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

Method admin

source/game/StarCommandProcessor.cpp:97–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97String CommandProcessor::admin(ConnectionId connectionId, String const&) {
98 auto config = Root::singleton().configuration();
99 if (m_universe->canBecomeAdmin(connectionId)) {
100 if (connectionId == ServerConnectionId)
101 return "Invalid client state";
102
103 if (!config->get("allowAdminCommands").toBool())
104 return "Admin commands disabled on this server.";
105
106 bool wasAdmin = m_universe->isAdmin(connectionId);
107 m_universe->setAdmin(connectionId, !wasAdmin);
108
109 if (!wasAdmin)
110 return strf("Admin privileges now given to player {}", m_universe->clientNick(connectionId));
111 else
112 return strf("Admin privileges taken away from {}", m_universe->clientNick(connectionId));
113 } else {
114 return "Insufficient privileges to make self admin.";
115 }
116}
117
118String CommandProcessor::pvp(ConnectionId connectionId, String const&) {
119 if (!m_universe->isPvp(connectionId)) {

Callers

nothing calls this directly

Calls 9

singletonClass · 0.85
strfFunction · 0.85
configurationMethod · 0.80
toBoolMethod · 0.80
canBecomeAdminMethod · 0.45
getMethod · 0.45
isAdminMethod · 0.45
setAdminMethod · 0.45
clientNickMethod · 0.45

Tested by

no test coverage detected