public override void Use(Player p, string message) { if (p == null) { Player.SendMessage(p, "Impossible depuis la console ou l'irc"); return; } if (message == "") { Player.SendMessage(p, "Toi"); return; } if (p.muted) { Player.SendMessage(p, "Vous etes actuellement en sourdine, vous ne pouvez pas utiliser cette commande."); return; } if (Server.chatmod && !p.voice) { Player.SendMessage(p, "La moderation du tchat est active. Vous ne pouvez pas vous exprime."); 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 == "") { Help(p); return; } 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 (p == null) { Player.SendMessage(p, "Impossible depuis la console ou l'irc"); return; } if (message != "list") { if (p.joker || Server.chatmod) { message = ""; } if (!Server.afkset.Contains(p.name)) { Server.afkset.Add(p.name); if (p.muted || Server.chatmod && !p.voice) { message = ""; } Player.GlobalMessage("-" + p.color + p.Name() + Server.DefaultColor + "- est AFK " + message); IRCBot.Say(p.name + " is AFK " + message); p.afkStart = DateTime.Now; return; } else { Server.afkset.Remove(p.name); Player.GlobalMessage("-" + p.color + p.Name() + Server.DefaultColor + "- n'est plus AFK"); IRCBot.Say(p.name + " n'est plus AFK"); return; } } else { foreach (string s in Server.afkset) { Player.SendMessage(p, s); } } }
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") { 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], msg.Split(' ')[1]) != 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], msg.Split(' ')[1]) != 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.Split(' ')[0], msg.Split(' ')[1]) != 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.Split(' ')[0], msg.Split(' ')[1]) != 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], msg.Split(' ')[1]) != 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; default: irc.SendMessage(SendType.Message, e.Data.Nick, "Invalid command."); break; } } else { irc.SendMessage(SendType.Message, e.Data.Nick, "Invalid command format."); } } }
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, "Nom invalide \"" + message + "\"."); return; } Group foundGroup = Group.findPlayerGroup(message); if (foundGroup.Permission >= LevelPermission.Operator) { Player.SendMessage(p, "Impossible de bannir un " + foundGroup.name + "!"); return; } if (foundGroup.Permission == LevelPermission.Banned) { Player.SendMessage(p, message + " est deja banni."); return; } foundGroup.playerList.Remove(message); foundGroup.playerList.Save(); Player.GlobalMessage(message + " &f(offline)" + Server.DefaultColor + " est maintenant &8banni" + Server.DefaultColor + "!"); Group.findPerm(LevelPermission.Banned).playerList.Add(message); } else { if (!Player.ValidName(who.name)) { Player.SendMessage(p, "nom invalide \"" + who.name + "\"."); return; } if (who.group.Permission >= LevelPermission.Operator) { Player.SendMessage(p, "Impossible de bannir un " + who.group.name + "!"); return; } if (who.group.Permission == LevelPermission.Banned) { Player.SendMessage(p, message + " est deja banni."); return; } who.group.playerList.Remove(message); who.group.playerList.Save(); if (stealth) { Player.GlobalMessageOps(who.color + who.name + Server.DefaultColor + " est maintenant &8banni discretement" + Server.DefaultColor + "!"); } else { Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " est maintenant &8banni" + 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) { if (message == "") { for (int i = 0; i < Server.levels.Count; i++) { if (Server.levels[i].physics > 0) { Player.SendMessage(p, "&5" + Server.levels[i].name + Server.DefaultColor + "(" + Server.levels[i].world + ") physics au niveau &b" + Server.levels[i].physics + Server.DefaultColor + ". &cChecks: " + Server.levels[i].lastCheck + "; Sauvegardes: " + Server.levels[i].lastUpdate); } } return; } try { int temp = 0; Level level = null; if (message.IndexOf(' ') == -1) { temp = int.Parse(message); if (p != null) { level = p.level; } else { level = Server.mainLevel; } } else { if (message.Split(' ').Length > 3) { Help(p); return; } string lvl = ""; string world = ""; if (message.Split(' ').Length == 2) { lvl = message.Split(' ')[0]; if (p == null) { world = Server.mainWorld; } else { world = p.level.world; } temp = System.Convert.ToInt16(message.Split(' ')[1]); } else { lvl = message.Split(' ')[0]; world = message.Split(' ')[1]; temp = System.Convert.ToInt16(message.Split(' ')[2]); } level = Level.Find(lvl, world); if (level == null) { Player.SendMessage(p, "Map introuvable"); return; } } if (p != null) { if (level.world.ToLower() != p.name.ToLower() && p.group.Permission < LevelPermission.Operator) { Player.SendMessage(p, "Vous ne pouvez pas changer le niveau de physiques dans cette map"); return; } if (!p.vip) { if (temp >= 2 && p.group.Permission <= LevelPermission.Builder) { Player.SendMessage(p, "Vous n'avez pas le rang pour mettre ce niveau de physics"); return; } } else { if (temp > 3 && p.group.Permission < LevelPermission.Operator) { Player.SendMessage(p, "Vous n'avez pas le rang pour mettre ce niveau de physics"); return; } } } string mes = ""; if (temp >= 0 && temp <= 4) { level.setPhysics(temp); switch (temp) { case 0: level.ClearPhysics(); mes = "Les physiques sont maintenant &cDesactive" + Server.DefaultColor + " sur &b" + level.name + Server.DefaultColor + "."; Server.s.Log("Physics are now OFF on " + level.name + " " + level.world + "."); IRCBot.Say("Physics are now OFF on " + level.name + " " + level.world + "."); break; case 1: mes = "Les physiques sont maintenant &aNormales" + Server.DefaultColor + " sur &b" + level.name + Server.DefaultColor + "."; Server.s.Log("Physics are now ON on " + level.name + " " + level.world + "."); IRCBot.Say("Physics are now ON on " + level.name + " " + level.world + "."); break; case 2: mes = "Les physiques sont maintenant &aAvancees" + Server.DefaultColor + " sur &b" + level.name + Server.DefaultColor + "."; Server.s.Log("Physics are now ADVANCED on " + level.name + " " + level.world + "."); IRCBot.Say("Physics are now ADVANCED on " + level.name + " " + level.world + "."); break; case 3: mes = "Les physiques sont maintenant &aHardcore" + Server.DefaultColor + " sur &b" + level.name + Server.DefaultColor + "."; Server.s.Log("Physics are now HARDCORE on " + level.name + " " + level.world + "."); IRCBot.Say("Physics are now HARDCORE on " + level.name + " " + level.world + "."); break; case 4: mes = "Les physiques sont maintenant &aInstantanees" + Server.DefaultColor + " sur &b" + level.name + Server.DefaultColor + "."; Server.s.Log("Physics are now INSTANT on " + level.name + " " + level.world + "."); IRCBot.Say("Physics are now INSTANT on " + level.name + " " + level.world + "."); break; } foreach (Player pl in Player.players) { if (pl.level.world == level.world) { Player.SendMessage(pl, mes); } } level.changed = true; } else { Player.SendMessage(p, "Parametre invalide"); } } catch { Player.SendMessage(p, "ENTREE INVALIDE !"); } }
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, "Impossible de trouver une adresse IP pour ce joueur."); 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, "Impossible de banip le serveur"); return; } if (message.IndexOf('.') == -1) { Player.SendMessage(p, "IP invalide!"); return; } if (message.Split('.').Length != 4) { Player.SendMessage(p, "IP invalide!"); return; } if (p != null) { if (p.ip == message) { Player.SendMessage(p, "Vous ne pouvez pas vous banip vous meme!"); return; } } if (Server.bannedIP.Contains(message)) { Player.SendMessage(p, message + " est deja banip !"); return; } Player.GlobalMessage(message + " est &8banip!"); 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()); }