コード例 #1
0
        public string Execute(ICharacter character, int?minutes = null)
        {
            if (character == null)
            {
                throw new Exception("The character name is not provided");
            }

            if (character == this.ExecutionContextCurrentCharacter)
            {
                throw new Exception("You cannot mute yourself");
            }

            if (minutes == null)
            {
                minutes = DefaultDuration;
            }

            if (minutes < 1)
            {
                throw new Exception($"Minutes must be in 1-{int.MaxValue} range");
            }

            ServerPlayerMuteSystem.Mute(character, minutes.Value);
            return(string.Format("{0} successfully muted on the server for {1}",
                                 character.Name,
                                 ClientTimeFormatHelper.FormatTimeDuration(minutes.Value * 60.0)));
        }