using System.Collections.Generic; using Newtonsoft.Json; using System.Linq; namespace Oxide.Plugins { [Info("NameCheck", "MikeHawke", "1.0.1")] [Description("Checks Names")] class NameCheck : RustPlugin { private ConfigData configData; class ConfigData { [JsonProperty(PropertyName = "Names")] public List Names = new List(); [JsonProperty(PropertyName = "Kick Message")] public string kikmsg = "Change your name to enter this server"; } void Init() { if (!LoadConfigVariables()) { Puts("Config file issue detected. Please delete file, or check syntax and fix."); return; } } private bool LoadConfigVariables() { try { configData = Config.ReadObject(); } catch { return false; } SaveConfig(configData); return true; } protected override void LoadDefaultConfig() { Puts("Creating new config file."); configData = new ConfigData(); SaveConfig(configData); } void SaveConfig(ConfigData config) { Config.WriteObject(config, true); } void OnPlayerConnected(BasePlayer player) { var name = player.displayName.ToLower().ToString(); bool K = configData.Names.Any(name.ToLower().Contains); if (K == true) { Network.Net.sv.Kick(player.net.connection, rust.QuoteSafe(configData.kikmsg)); } } } }