示例#1
0
        /// <summary>
        /// Initializes the data files from the disk
        /// </summary>
        public void InitializeDataFiles()
        {
            // Load the lookup files
            EventPoints    = new EventPointTable();
            Settings       = new SettingsTable();
            Statistics     = new StatisticsTable();
            CustomCommands = new CustomCommandsTable();
            Rules          = new RuleTable();
            Mutes          = new MuteTable();
            Bans           = new BanTable();

            UnityDocs = new UnityDocs("manualReference.json", "scriptReference.json");
            Cooldowns = CooldownData.FromPath("cooldowns.json");
        }
        public void Ban(Client client, int minutes = 0, string reason = "")
        {
            var previousBan = Services.GetService <DatabaseService>().DatabaseGet <BanTable>(client.ID);

            if (previousBan != null)
            {
                Logger.Log(LogType.Event, $"Player {client.Name} was already banned! Reason - \"{previousBan.Reason}\". Unban time - {previousBan.UnbanTime:G}!");
                return;
            }

            var banTable = new BanTable(client, DateTime.UtcNow + TimeSpan.FromMinutes(minutes <= 0 ? int.MaxValue : minutes), reason);

            Services.GetService <DatabaseService>().DatabaseSet(banTable);
            client.SendBan(banTable);
            Logger.Log(LogType.Event, $"Player {client.Name} was banned. Reason - \"{banTable.Reason}\". Unban time - {banTable.UnbanTime:G}!");
        }
示例#3
0
 public override void SendBan(BanTable banTable)
 {
     SendKick($"You have banned from this server; Reason: {banTable.Reason} Time left: {(banTable.UnbanTime - DateTime.UtcNow):%m} minutes; If you want to appeal your ban, please contact a staff member on the official forums (http://pokemon3d.net/forum/news/) or on the official Discord server (https://discord.me/p3d).");
     base.SendBan(banTable);
 }
示例#4
0
 public BanCommand(BanTable bans)
 {
     _bans = bans;
 }