コード例 #1
0
        public void RemoveCommand(Players.Player causedBy, string param)
        {
            if (!PermissionsManager.CheckAndWarnPermission(causedBy, AntiGrief.MOD_PREFIX + "announcements.remove"))
            {
                return;
            }
            int Index;

            if (!TryGetIndex(causedBy, param, REMOVE_PREFIX, out Index))
            {
                return;
            }
            Announcements.RemoveAnnouncement(Index);
            Chat.Send(causedBy, $"Removed announcement {Index} from queue");
        }
コード例 #2
0
 public void WelcomeCommand(Players.Player causedBy, string param)
 {
     if (!PermissionsManager.CheckAndWarnPermission(causedBy, AntiGrief.MOD_PREFIX + "announcements.welcome"))
     {
         return;
     }
     Announcements.SetWelcomeMessage(param);
     if (param.Length > 0)
     {
         Chat.Send(causedBy, $"Changed welcome message, see below\n{param}");
     }
     else
     {
         Chat.Send(causedBy, "Disabled welcome message");
     }
 }
コード例 #3
0
        public void ListCommand(Players.Player causedBy)
        {
            string msg;

            if (PermissionsManager.HasPermission(causedBy, AntiGrief.MOD_PREFIX + "announcements.list"))
            {
                msg = Announcements.ListAllAnnouncements();
            }
            else
            {
                msg = Announcements.ListEnabledAnnouncements();
            }
            if (msg.Length > 0)
            {
                Chat.Send(causedBy, $"Server Announcements:\n{msg}");
            }
            else
            {
                Chat.Send(causedBy, "No announcements");
            }
        }
コード例 #4
0
 public void DisableCommand(Players.Player causedBy, string param)
 {
     if (!PermissionsManager.CheckAndWarnPermission(causedBy, AntiGrief.MOD_PREFIX + "announcements.disable"))
     {
         return;
     }
     if (param.Length > 0)
     {
         int Index;
         if (!TryGetIndex(causedBy, param, DISABLE_PREFIX, out Index))
         {
             return;
         }
         Announcements.DisableAnnouncement(Index);
         Chat.Send(causedBy, $"Disabled announcement {Index}");
     }
     else
     {
         Announcements.DisableAllAnnouncements();
         Chat.Send(causedBy, "Disabled all announcements");
     }
 }
コード例 #5
0
        public void IntervalCommand(Players.Player causedBy, string param)
        {
            if (!PermissionsManager.CheckAndWarnPermission(causedBy, AntiGrief.MOD_PREFIX + "announcements.interval"))
            {
                return;
            }
            var m = Regex.Match(param, @"(?<intervalSeconds>\d+)");

            if (!m.Success)
            {
                Chat.Send(causedBy, $"Params didn't match, use {INTERVAL_PREFIX} [intervalSeconds]");
                return;
            }
            int    Interval;
            string StrInterval = m.Groups ["intervalSeconds"].Value;

            if (!int.TryParse(StrInterval, out Interval))
            {
                Chat.Send(causedBy, $"Could not parse given parameter '{StrInterval}' as index number");
                return;
            }
            Announcements.SetIntervalSeconds(Interval);
            Chat.Send(causedBy, $"Set announcement interval to {Interval} seconds");
        }