Beispiel #1
0
        /// <inheritdoc/>
        public override void OnLoadPlugin()
        {
            this.interval    = this.CreateConVar("AdvertInterval", "20", "The time in minutes between advertisements.", true, 1).Value;
            this.randomOrder = this.CreateConVar("AdvertRandomOrder", "False", "Whether to show advertisements in random order.").Value;

            this.AutoExecConfig(true, "Advertisements");
        }
Beispiel #2
0
        /// <inheritdoc/>
        public override void OnLoadPlugin()
        {
            this.floodTime = this.CreateConVar("FloodTime", "0.75", "The time in seconds allowed between chat messages.", true, 0).Value;

            this.AutoExecConfig(true, "AntiFlood");

            ChatHook.ChatMessage += this.OnChatMessage;
        }
Beispiel #3
0
        /// <summary>
        /// Initializes the language system.
        /// </summary>
        public static void Init()
        {
            serverLang = ConVarManager.CreateConVar(null, "ServerLang", DefaultLang, "The language key for the server").Value;
            serverLang.ConVar.ValueChanged += OnServerLanguageChanged;

            foreach (var file in coreFiles)
            {
                LoadPhrases(file);
            }
        }
Beispiel #4
0
        /// <inheritdoc/>
        public override void OnLoadPlugin()
        {
            this.LoadTranslations("ReservedSlots.Plugin");

            this.reservedSlots = this.CreateConVar("ReservedSlots", "0", "The number of reserved slots.", true, 0).Value;

            this.AutoExecConfig(true, "ReservedSlots");

            this.maxPlayers = GamePrefs.GetInt(EnumGamePrefs.ServerMaxPlayerCount);
        }
Beispiel #5
0
        /// <inheritdoc/>
        public override void OnLoadPlugin()
        {
            this.LoadTranslations("BloodMoon.Plugin");

            this.interval    = this.CreateConVar("BloodMoonInterval", "7", "The number of days between blood moons.", true, 1).Value;
            this.showOnSpawn = this.CreateConVar("BloodMoonShowOnSpawn", "True", "Whether to show the number of days until the next blood moon to newly spawned players.").Value;

            this.AutoExecConfig(true, "BloodMoon");

            this.RegAdminCmd("bloodmoon", 0, "Bloodmoon Description").Executed += this.OnBloodmoonCommandExecuted;
        }
Beispiel #6
0
        /// <inheritdoc/>
        public override void OnLoadPlugin()
        {
            this.LoadTranslations("BaseVotes.Plugin");

            this.voteBanPercent  = this.CreateConVar("VoteBanPercent", "0.60", "The percentage of players that must vote yes for a successful ban vote.", true, 0, true, 1).Value;
            this.voteKickPercent = this.CreateConVar("VoteKickPercent", "0.60", "The percentage of players that must vote yes for a successful kick vote.", true, 0, true, 1).Value;

            this.AutoExecConfig(true, "BaseVotes");

            this.RegAdminCmd("vote", AdminFlags.Vote, "Vote Description").Executed         += this.OnVoteCommandExecuted;
            this.RegAdminCmd("voteban", AdminFlags.Vote, "Voteban Description").Executed   += this.OnVotebanCommandExecuted;
            this.RegAdminCmd("votekick", AdminFlags.Vote, "Votekick Description").Executed += this.OnVotekickCommandExecuted;
        }
Beispiel #7
0
        /// <summary>
        /// Initializes the chat helper.
        /// </summary>
        public static void Init()
        {
            var description = new StringBuilder()
                              .AppendLine("Specifies how admin activity should be relayed to users. Add up the values below to get the functionality you want.")
                              .AppendLine("1: Show admin activity to non-admins anonymously.")
                              .AppendLine("2: If 1 is specified, admin names will be shown.")
                              .AppendLine("4: Show admin activity to admins anonymously.")
                              .AppendLine("8: If 4 is specified, admin names will be shown.")
                              .AppendLine("16: Always show admin names to root users.")
                              .AppendLine()
                              .AppendLine("Default: 13 (1+4+8)")
                              .ToString();

            showActivity = ConVarManager.CreateConVar(null, "ShowActivity", "13", description, true, 0, true, 31).Value;
        }
Beispiel #8
0
        /// <inheritdoc/>
        public override void OnLoadPlugin()
        {
            this.website          = this.CreateConVar("SBWebsite", string.Empty, "Website address to tell the player where to go for unban, etc").Value;
            this.addban           = this.CreateConVar("SBAddban", "True", "Allow or disallow admins access to addban command").Value;
            this.unban            = this.CreateConVar("SBUnban", "True", "Allow or disallow admins access to unban command").Value;
            this.databasePrefix   = this.CreateConVar("SBDatabasePrefix", "sb", "The Table prefix you set while installing the webpanel").Value;
            this.retryTime        = this.CreateConVar("SBRetryTime", "45.0", "How many seconds to wait before retrying when a players ban fails to be checked", true, 15, true, 60).Value;
            this.processQueueTime = this.CreateConVar("SBProcessQueueTime", "5", "How often should we process the failed ban queue in minutes").Value;
            this.backupConfigs    = this.CreateConVar("SBBackupConfigs", "True", "Enable backing up config files after getting admins from database").Value;
            this.enableAdmins     = this.CreateConVar("SBEnableAdmins", "True", "Enable admin part of the plugin").Value;
            this.requireSiteLogin = this.CreateConVar("SBRequireSiteLogin", "False", "Require the admin to login once into website").Value;
            this.serverId         = this.CreateConVar("SBServerId", "0", "This is the ID of this server (Check in the admin panel -> servers to find the ID of this server)").Value;

            this.AutoExecConfig(true, "SourceBans");
        }
Beispiel #9
0
        /// <inheritdoc/>
        public override void OnLoadPlugin()
        {
            if (GamePrefs.GetInt(EnumGamePrefs.BloodMoonRange) != 0)
            {
                this.SetFailState("Server preference BloodMoonRange must be set to 0");
            }

            this.LoadTranslations("BloodMoon.Plugin");

            this.showOnSpawn = this.CreateConVar("BloodMoonShowOnSpawn", "True", "Whether to show the number of days until the next blood moon to newly spawned players.").Value;

            this.AutoExecConfig(true, "BloodMoon");

            this.RegAdminCmd("bloodmoon", 0, "Bloodmoon Description").Executed += this.OnBloodmoonCommandExecuted;

            this.interval = GamePrefs.GetInt(EnumGamePrefs.BloodMoonFrequency);
        }
Beispiel #10
0
        /// <inheritdoc/>
        public override void OnLoadPlugin()
        {
            this.LoadTranslations("BaseChat.Plugin");

            this.chatMode = this.CreateConVar("ChatMode", "True", "Allow players to send messages to admin chat.").Value;

            this.AutoExecConfig(true, "BaseChat");

            this.sayCommand  = this.RegAdminCmd("say", AdminFlags.Chat, "Say Description");
            this.psayCommand = this.RegAdminCmd("psay", AdminFlags.Chat, "Psay Description");
            this.chatCommand = this.RegAdminCmd("chat", AdminFlags.Chat, "Chat Description");

            this.sayCommand.Executed  += this.OnSayCommandExecuted;
            this.psayCommand.Executed += this.OnPsayCommandExecuted;
            this.chatCommand.Executed += this.OnChatCommandExecuted;

            ChatHook.ChatMessage += this.OnChatMessage;
        }
Beispiel #11
0
        /// <inheritdoc/>
        public override void OnLoadPlugin()
        {
            this.LoadTranslations("ServerShutdown.Plugin");

            this.autoRestart          = this.CreateConVar("ServerShutdownAutoRestart", "True", "Enable if the server is set up to automatically restart after crashing.").Value;
            this.schedule             = this.CreateConVar("ServerShutdownSchedule", string.Empty, "The automatic shutdown schedule in the format HH:MM. Separate multiple times with commas.").Value;
            this.countdownTime        = this.CreateConVar("ServerShutdownCountdownTime", "5", "The countdown time in minutes for scheduled shutdowns.", true, 1, true, 20).Value;
            this.enableRestartCommand = this.CreateConVar("ServerShutdownEnableRestartCommand", "True", "Enable the restart admin command.").Value;
            this.enableVote           = this.CreateConVar("ServerShutdownEnableVote", "True", "Enable the voteshutdown admin command.").Value;
            this.votePercent          = this.CreateConVar("ServerShutdownVotePercent", "0.60", "The percentage of players that must vote yes for a successful shutdown vote.", true, 0, true, 1).Value;

            this.AutoExecConfig(true, "ServerShutdown");

            this.RegisterCommands();

            this.autoRestart.ConVar.ValueChanged   += this.OnAutoRestartChanged;
            this.schedule.ConVar.ValueChanged      += this.OnScheduleChanged;
            this.countdownTime.ConVar.ValueChanged += this.OnCountdownTimeChanged;
        }
Beispiel #12
0
        /// <inheritdoc/>
        public override void OnLoadPlugin()
        {
            this.silentChatTrigger = this.FindConVar("SilentChatTrigger").Value;
            this.logPlayerChat     = this.CreateConVar("LogPlayerChat", "True", "Whether to log player chat messages.").Value;
            this.logChatRecipients = this.CreateConVar("LogChatRecipients", "False", "Whether to list the recipients of friend and party chat messages.").Value;
            this.logPlayerKills    = this.CreateConVar("LogPlayerKills", "True", "Whether to log player kills.").Value;

            this.AutoExecConfig(true, "PlayerLog");

            if (this.log == null)
            {
                var fileName = $"player_{DateTime.Now.ToString("yyyyMMdd")}.log";
                this.log = new StreamWriter($"{SMPath.Logs}{fileName}", true);
                this.WriteLine($"Player log file session started (file \"{fileName}\") (Plugin version \"{this.Info.Version}\")");
            }

            ChatHook.ChatMessage += this.OnChatMessage;

            this.logPlayerKills.ConVar.ValueChanged += this.OnLogPlayerKillsChanged;
        }
Beispiel #13
0
 /// <summary>
 /// Initializes the voting system.
 /// </summary>
 internal static void Init()
 {
     ShowVoteProgress = ConVarManager.CreateConVar(null, "ShowVoteProgress", "True", "Show votes in chat.").Value;
 }
Beispiel #14
0
 /// <summary>
 /// Initializes the chat hook system.
 /// </summary>
 internal static void Init()
 {
     publicChatTrigger = ConVarManager.CreateConVar(null, "PublicChatTrigger", "!", "Chat prefix for public commands.").Value;
     silentChatTrigger = ConVarManager.CreateConVar(null, "SilentChatTrigger", "/", "Chat prefix for silent commands.").Value;
 }