fCraft.ModerationCommands.Basscannon C# (CSharp) Method

Basscannon() static private method

static private Basscannon ( Player player, Command cmd ) : void
player Player
cmd Command
return void
        internal static void Basscannon( Player player, Command cmd )
        {
            string name = cmd.Next();
            string reason = cmd.NextAll();

            if ( name == null ) {
                player.Message( "Please enter a player name to use the basscannon on." );
                return;
            }

            Player target = Server.FindPlayerOrPrintMatches( player, name, false, true );
            if ( target == null )
                return;

            if ( ConfigKey.RequireKickReason.Enabled() && String.IsNullOrEmpty( reason ) ) {
                player.Message( "&WPlease specify a reason: &W/Basscannon PlayerName Reason" );
                // freeze the target player to prevent further damage
                return;
            }

            if ( player.Can( Permission.Kick, target.Info.Rank ) ) {
                target.Info.IsHidden = false;
                try {
                    target.BassKick( player, reason, LeaveReason.Kick, true, true, true );
                    if ( BassText.Count < 1 ) {
                        BassText.Add( "Flux Pavillion does not approve of your behavior" );
                        BassText.Add( "Let the Basscannon KICK IT!" );
                        BassText.Add( "WUB WUB WUB WUB WUB WUB!" );
                        BassText.Add( "Basscannon, Basscannon, Basscannon, Basscannon!" );
                        BassText.Add( "Pow pow POW!!!" );
                    }
                    string line = BassText[new Random().Next( 0, BassText.Count )].Trim();
                    if ( line.Length == 0 )
                        return;
                    Server.Message( "&9{0}", line );
                } catch ( PlayerOpException ex ) {
                    player.Message( ex.MessageColored );
                    if ( ex.ErrorCode == PlayerOpExceptionCode.ReasonRequired )
                        return;
                }
            } else {
                player.Message( "You can only use /Basscannon on players ranked {0}&S or lower",
                                player.Info.Rank.GetLimit( Permission.Kick ).ClassyName );
                player.Message( "{0}&S is ranked {1}", target.ClassyName, target.Info.Rank.ClassyName );
            }
        }