MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / LuaBzOrgCommand

Method LuaBzOrgCommand

src/lua/LuaClientScripts.cpp:289–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287
288
289bool LuaClientScripts::LuaBzOrgCommand(const std::string& cmdLine) {
290 const std::string prefix = "luabzorg";
291 const char* c = cmdLine.c_str();
292 if (strncmp(c, prefix.c_str(), prefix.size()) != 0) {
293 return false;
294 }
295 c = TextUtils::skipWhitespace(c + prefix.size());
296
297 const std::string cmd = c;
298 if (cmd == "reload") {
299 LuaBzOrg::FreeHandler();
300 if (BZDB.isTrue("_forbidLuaBzOrg")) {
301 showMessage("This server forbids LuaBzOrg scripts");
302 return false;
303 }
304 else {
305 LuaBzOrg::LoadHandler();
306 }
307 }
308 else if (cmd == "disable") {
309 const bool active = LuaBzOrg::IsActive();
310 LuaBzOrg::FreeHandler();
311 if (active) {
312 showMessage("LuaBzOrg disabled");
313 }
314 }
315 else if (cmd == "status") {
316 if (luaBzOrg != NULL) {
317 showMessage("LuaBzOrg is enabled");
318 }
319 else if (LuaBzOrg::IsActive()) {
320 showMessage("LuaBzOrg is loading");
321 }
322 else {
323 showMessage("LuaBzOrg is disabled");
324 }
325 }
326 else if (cmd == "") {
327 addMessage(NULL,
328 "/luabzorg < status | reload | disable | custom_command ... >");
329 }
330 else if (luaBzOrg != NULL) {
331 return luaBzOrg->RecvCommand(c);
332 }
333 else {
334 return false;
335 }
336
337 return true;
338}
339
340
341bool LuaClientScripts::LuaWorldCommand(const std::string& cmdLine) {

Callers

nothing calls this directly

Calls 7

skipWhitespaceFunction · 0.85
addMessageFunction · 0.85
c_strMethod · 0.80
isTrueMethod · 0.80
showMessageFunction · 0.50
sizeMethod · 0.45
RecvCommandMethod · 0.45

Tested by

no test coverage detected