fCraft.MaintenanceCommands.DoPlayerDB C# (CSharp) Method

DoPlayerDB() private static method

private static DoPlayerDB ( Player player, Command cmd ) : void
player Player
cmd Command
return void
        private static void DoPlayerDB( Player player, Command cmd )
        {
            string p1Name = cmd.Next();
            string p2Name = cmd.Next();
            if ( p1Name == null || p2Name == null ) {
                CdInfoSwap.PrintUsage( player );
                return;
            }

            PlayerInfo p1 = PlayerDB.FindPlayerInfoOrPrintMatches( player, p1Name );
            if ( p1 == null )
                return;
            PlayerInfo p2 = PlayerDB.FindPlayerInfoOrPrintMatches( player, p2Name );
            if ( p2 == null )
                return;

            if ( p1 == p2 ) {
                player.Message( "InfoSwap: Please specify 2 different players." );
                return;
            }

            if ( p1.IsOnline || p2.IsOnline ) {
                player.Message( "InfoSwap: Both players must be offline to swap info." );
                return;
            }

            if ( !cmd.IsConfirmed ) {
                player.Confirm( cmd, "InfoSwap: Swap stats of players {0}&S and {1}&S?", p1.ClassyName, p2.ClassyName );
                return;
            } else {
                PlayerDB.SwapPlayerInfo( p1, p2 );
                player.Message( "InfoSwap: Stats of {0}&S and {1}&S have been swapped.",
                                p1.ClassyName, p2.ClassyName );
            }
        }