public override void Use(Player p, string message) { if (message == "") { Player.SendMessage(p, "You"); return; } if (p.muted) { Player.SendMessage(p, "You are currently muted and cannot use this command."); return; } if (Server.chatmod && !p.voice) { Player.SendMessage(p, "Chat moderation is on, you cannot emote."); return; } if (Server.worldChat) { Player.GlobalChat(p, p.color + "*" + p.name + " " + message, false); } else { Player.GlobalChatLevel(p, p.color + "*" + p.name + " " + message, false); } IRCBot.Say("*" + p.name + " " + message); }
public override void Use(Player p, string message) { if (message != "list") { if (p.joker) { message = ""; } if (!Server.afkset.Contains(p.name)) { Server.afkset.Add(p.name); if (p.muted) { message = ""; } Player.GlobalMessage("-" + p.color + p.name + Server.DefaultColor + "- is AFK " + message); IRCBot.Say(p.name + " is AFK " + message); return; } else { Server.afkset.Remove(p.name); Player.GlobalMessage("-" + p.color + p.name + Server.DefaultColor + "- is no longer AFK"); IRCBot.Say(p.name + " is no longer AFK"); return; } } else { foreach (string s in Server.afkset) { Player.SendMessage(p, s); } } }
public override void Use(Player p, string message) { if (message == "") { Help(p); return; } message = message.Replace("%", "&"); // Alow colors in global messages Player.GlobalChat(p, message, false); message = message.Replace("&", ""); // converts the MC color codes to IRC. Doesn't seem to work with multiple colors IRCBot.Say(message); }
public override void Use(Player p, string message) { if (message == "") { Help(p); return; } if (message[0] == '@') { message = message.Remove(0, 1).Trim(); Player who = Player.Find(message); if (who == null) { DataTable ip; int tryCounter = 0; rerun : try { ip = MySQL.fillData("SELECT IP FROM Players WHERE Name = '" + message + "'"); } catch (Exception e) { tryCounter++; if (tryCounter < 10) { goto rerun; } else { Server.ErrorLog(e); return; } } if (ip.Rows.Count > 0) { message = ip.Rows[0]["IP"].ToString(); } else { Player.SendMessage(p, "Unable to find an IP address for that user."); return; } ip.Dispose(); } else { message = who.ip; } } else { Player who = Player.Find(message); if (who != null) { message = who.ip; } } if (message.Equals("127.0.0.1")) { Player.SendMessage(p, "You can't ip-ban the server!"); return; } if (message.IndexOf('.') == -1) { Player.SendMessage(p, "Invalid IP!"); return; } if (message.Split('.').Length != 4) { Player.SendMessage(p, "Invalid IP!"); return; } if (p != null) { if (p.ip == message) { Player.SendMessage(p, "You can't ip-ban yourself.!"); return; } } if (Server.bannedIP.Contains(message)) { Player.SendMessage(p, message + " is already ip-banned."); return; } Player.GlobalMessage(message + " got &8ip-banned!"); if (p != null) { IRCBot.Say("IP-BANNED: " + message.ToLower() + " by " + p.name); } else { IRCBot.Say("IP-BANNED: " + message.ToLower() + " by console"); } Server.bannedIP.Add(message); Server.bannedIP.Save("banned-ip.txt", false); Server.s.Log("IP-BANNED: " + message.ToLower()); /* * foreach (Player pl in Player.players) { * if (message == pl.ip) { pl.Kick("Kicked by ipban"); } * }*/ }
public override void Use(Player p, string message) { if (message == "") { foreach (Level l in Server.levels) { if (l.physics > 0) { Player.SendMessage(p, "&5" + l.name + Server.DefaultColor + " has physics at &b" + l.physics + Server.DefaultColor + ". &cChecks: " + l.lastCheck + "; Updates: " + l.lastUpdate); } } return; } try { int temp = 0; Level level = null; if (message.Split(' ').Length == 1) { temp = int.Parse(message); if (p != null) { level = p.level; } else { level = Server.mainLevel; } } else { temp = System.Convert.ToInt16(message.Split(' ')[1]); string nameStore = message.Split(' ')[0]; level = Level.Find(nameStore); } if (temp >= 0 && temp <= 4) { level.setPhysics(temp); switch (temp) { case 0: level.ClearPhysics(); Player.GlobalMessage("Physics are now &cOFF" + Server.DefaultColor + " on &b" + level.name + Server.DefaultColor + "."); Server.s.Log("Physics are now OFF on " + level.name + "."); IRCBot.Say("Physics are now OFF on " + level.name + "."); break; case 1: Player.GlobalMessage("Physics are now &aNormal" + Server.DefaultColor + " on &b" + level.name + Server.DefaultColor + "."); Server.s.Log("Physics are now ON on " + level.name + "."); IRCBot.Say("Physics are now ON on " + level.name + "."); break; case 2: Player.GlobalMessage("Physics are now &aAdvanced" + Server.DefaultColor + " on &b" + level.name + Server.DefaultColor + "."); Server.s.Log("Physics are now ADVANCED on " + level.name + "."); IRCBot.Say("Physics are now ADVANCED on " + level.name + "."); break; case 3: Player.GlobalMessage("Physics are now &aHardcore" + Server.DefaultColor + " on &b" + level.name + Server.DefaultColor + "."); Server.s.Log("Physics are now HARDCORE on " + level.name + "."); IRCBot.Say("Physics are now HARDCORE on " + level.name + "."); break; case 4: Player.GlobalMessage("Physics are now &aInstant" + Server.DefaultColor + " on &b" + level.name + Server.DefaultColor + "."); Server.s.Log("Physics are now INSTANT on " + level.name + "."); IRCBot.Say("Physics are now INSTANT on " + level.name + "."); break; } level.changed = true; } else { Player.SendMessage(p, "Not a valid setting"); } } catch { Player.SendMessage(p, "INVALID INPUT"); } }
public override void Use(Player p, string message) { try { if (message == "") { Help(p); return; } bool stealth = false; bool totalBan = false; if (message[0] == '#') { message = message.Remove(0, 1).Trim(); stealth = true; Server.s.Log("Stealth Ban Attempted"); } else if (message[0] == '@') { totalBan = true; message = message.Remove(0, 1).Trim(); } Player who = Player.Find(message); if (who == null) { if (!Player.ValidName(message)) { Player.SendMessage(p, "Invalid name \"" + message + "\"."); return; } Group foundGroup = Group.findPlayerGroup(message); if (foundGroup.Permission >= LevelPermission.Operator) { Player.SendMessage(p, "You can't ban a " + foundGroup.name + "!"); return; } if (foundGroup.Permission == LevelPermission.Banned) { Player.SendMessage(p, message + " is already banned."); return; } foundGroup.playerList.Remove(message); foundGroup.playerList.Save(); Player.GlobalMessage(message + " &f(offline)" + Server.DefaultColor + " is now &8banned" + Server.DefaultColor + "!"); Group.findPerm(LevelPermission.Banned).playerList.Add(message); } else { if (!Player.ValidName(who.name)) { Player.SendMessage(p, "Invalid name \"" + who.name + "\"."); return; } if (who.group.Permission >= LevelPermission.Operator) { Player.SendMessage(p, "You can't ban a " + who.group.name + "!"); return; } if (who.group.Permission == LevelPermission.Banned) { Player.SendMessage(p, message + " is already banned."); return; } who.group.playerList.Remove(message); who.group.playerList.Save(); if (stealth) { Player.GlobalMessageOps(who.color + who.name + Server.DefaultColor + " is now STEALTH &8banned" + Server.DefaultColor + "!"); } else { Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " is now &8banned" + Server.DefaultColor + "!", false); } who.group = Group.findPerm(LevelPermission.Banned); who.color = who.group.color; Player.GlobalDie(who, false); Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); Group.findPerm(LevelPermission.Banned).playerList.Add(who.name); } Group.findPerm(LevelPermission.Banned).playerList.Save(); IRCBot.Say(message + " was banned."); Server.s.Log("BANNED: " + message.ToLower()); if (totalBan == true) { Command.all.Find("undo").Use(p, message + " 0"); Command.all.Find("banip").Use(p, "@ " + message); } } catch (Exception e) { Server.ErrorLog(e); } }
public override void Use(Player p, string message) { IRCBot.Reset(); }
void OnPrivMsg(object sender, IrcEventArgs e) { Server.s.Log("IRC RECEIVING MESSAGE"); if (Server.ircControllers.Contains(e.Data.Nick)) { string cmd; string msg; int len = e.Data.Message.Split(' ').Length; cmd = e.Data.Message.Split(' ')[0]; if (len > 1) { msg = e.Data.Message.Substring(e.Data.Message.IndexOf(' ')).Trim(); } else { msg = ""; } if (msg != "" || cmd == "restart" || cmd == "update") { Server.s.Log(cmd + " : " + msg); switch (cmd) { case "kick": if (Player.Find(msg.Split()[0]) != null) { Command.all.Find("kick").Use(null, msg); } else { irc.SendMessage(SendType.Message, e.Data.Nick, "Player not found."); } break; case "ban": if (Player.Find(msg) != null) { Command.all.Find("ban").Use(null, msg); } else { irc.SendMessage(SendType.Message, e.Data.Nick, "Player not found."); } break; case "banip": if (Player.Find(msg) != null) { Command.all.Find("banip").Use(null, msg); } else { irc.SendMessage(SendType.Message, e.Data.Nick, "Player not found."); } break; case "say": irc.SendMessage(SendType.Message, channel, msg); break; case "setrank": if (Player.Find(msg.Split(' ')[0]) != null) { Command.all.Find("setrank").Use(null, msg); } else { irc.SendMessage(SendType.Message, e.Data.Nick, "Player not found."); } break; case "mute": if (Player.Find(msg) != null) { Command.all.Find("mute").Use(null, msg); } else { irc.SendMessage(SendType.Message, e.Data.Nick, "Player not found."); } break; case "joker": if (Player.Find(msg) != null) { Command.all.Find("joker").Use(null, msg); } else { irc.SendMessage(SendType.Message, e.Data.Nick, "Player not found."); } break; case "physics": if (Level.Find(msg.Split(' ')[0]) != null) { Command.all.Find("physics").Use(null, msg); } else { irc.SendMessage(SendType.Message, e.Data.Nick, "Map not found."); } break; case "load": if (Level.Find(msg.Split(' ')[0]) != null) { Command.all.Find("load").Use(null, msg); } else { irc.SendMessage(SendType.Message, e.Data.Nick, "Map not found."); } break; case "unload": if (Level.Find(msg) != null || msg == "empty") { Command.all.Find("unload").Use(null, msg); } else { irc.SendMessage(SendType.Message, e.Data.Nick, "Map not found."); } break; case "save": if (Level.Find(msg) != null) { Command.all.Find("save").Use(null, msg); } else { irc.SendMessage(SendType.Message, e.Data.Nick, "Map not found."); } break; case "map": if (Level.Find(msg.Split(' ')[0]) != null) { Command.all.Find("map").Use(null, msg); } else { irc.SendMessage(SendType.Message, e.Data.Nick, "Map not found."); } break; case "restart": Player.GlobalMessage("Restart initiated by " + e.Data.Nick); IRCBot.Say("Restart initiated by " + e.Data.Nick); Command.all.Find("restart").Use(null, ""); break; case "update": Player.GlobalMessage("Update check initiated by " + e.Data.Nick); IRCBot.Say("Update check initiated by " + e.Data.Nick); Command.all.Find("update").Use(null, ""); break; default: irc.SendMessage(SendType.Message, e.Data.Nick, "Invalid command."); break; } } else { irc.SendMessage(SendType.Message, e.Data.Nick, "Invalid command format."); } } }