private static void messageReceived(Client c, string message) { PluginLog(Log.Level.Debug, "MESSAGE: " + message); EClientStatus status = c.getCurrentStatus(); if (message == "quit") { s.kickClient(c); return; } if (message == "help") { s.sendMessageToClient(c, "\r\n" + Resources.help + "\r\n"); return; } if (message.StartsWith("help ")) { var helpcmd = message.Replace("help ", ""); s.sendMessageToClient(c, "\r\nerror id=1337 msg=currently\\snot\\simplemented\r\n"); //s.sendMessageToClient(c, Resources[helpcmd]); return; } switch (status) { case EClientStatus.Guest: if (message == "auth apikey=" + Settings.Default.ApiKey) { s.clearClientScreen(c); s.sendMessageToClient(c, "\r\nerror id=0 msg=ok\r\n"); c.setStatus(EClientStatus.LoggedIn); return; } else { s.sendMessageToClient(c, "\r\nerror id=1796 msg=currently\\snot\\spossible\r\n"); return; } case EClientStatus.LoggedIn: if (message == "logout") { c.setStatus(EClientStatus.Guest); s.sendMessageToClient(c, "\r\nerror id=0 msg=ok\r\n"); return; } break; } if (message.StartsWith("gm msg=")) { try { lib.SendGlobalMessage(message.Replace("gm msg=", "")); s.sendMessageToClient(c, "\r\nerror id=0 msg=ok\r\n"); } catch (Exception) { s.sendMessageToClient(c, "\r\nerror id=1 msg=error\r\n"); } return; } switch (message) { default: s.sendMessageToClient(c, "\r\nerror id=256 msg=command\\snot\\sfound\r\n"); return; } }
public void CommandTest(string str) { lib.SendGlobalMessage(str); }