fCraft.LifeHandler.OnList C# (CSharp) Method

OnList() private static method

private static OnList ( Player p, Command cmd ) : void
p Player
cmd Command
return void
        private static void OnList( Player p, Command cmd )
        {
            World w = p.World;
            if ( null == w ) {
                p.Message( "&WYou are in limbo state. Prepare for eternal torment." );
                return;
            }
            string param = cmd.Next();
            Func<Life2DZone, bool> f = l => true;
            if ( !string.IsNullOrWhiteSpace( param ) ) {
                switch (param)
                {
                    case "started":
                        f = l => !l.Stopped;
                        break;
                    case "stopped":
                        f = l => l.Stopped;
                        break;
                    default:
                        p.Message( "&WUnrecognised parameter " + param + ". Ignored.\n" );
                        break;
                }
            }
            int i = 0;
            foreach ( Life2DZone life in w.GetLifes().Where( life => f( life ) ) ) {
                if ( i++ > 0 )
                    p.Message( ", " );
                p.Message( ( life.Stopped ? "&8" : "&2" ) + life.Name );
            }
        }