public override void Create(CommandParser Parser) { Parser.AddCommand( Sequence( RequiredRank(500), KeyWord("KICK"), Or( Object("PLAYER", new ConnectedPlayersObjectSource(), ObjectMatcherSettings.None), SingleWord("MASK")))) .Manual("Makes bad people go away.") .ProceduralRule((match, actor) => { if (match.ContainsKey("PLAYER")) { KickPlayer(match["PLAYER"] as Actor, actor); } else { var mask = match["MASK"].ToString(); var maskRegex = new System.Text.RegularExpressions.Regex(ProscriptionList.ConvertGlobToRegex(mask), System.Text.RegularExpressions.RegexOptions.IgnoreCase); //Iterate over local copy because kicking modifies ConnectedClients. foreach (var client in new List <Client>(Clients.ConnectedClients)) { var netClient = client as NetworkClient; if (netClient != null && netClient.IsLoggedOn && maskRegex.Matches(netClient.IPString).Count > 0) { Core.MarkLocaleForUpdate(client.Player); KickPlayer(client.Player, actor); } } } return(PerformResult.Continue); }); }
public static void AtStartup(RuleEngine GlobalRules) { ProscriptionList = new ProscriptionList("proscriptions.txt"); }
public static void AtStartup(RuleEngine GlobalRules) { ProscriptionList = new ProscriptionList("proscriptions.txt"); }