fCraft.MessageBlock.GenerateName C# (CSharp) Method

GenerateName() public static method

public static GenerateName ( World world ) : String
world World
return String
        public static String GenerateName( World world )
        {
            if ( world.Map.MessageBlocks != null ) {
                if ( world.Map.MessageBlocks.Count > 0 ) {
                    bool found = false;

                    while ( !found ) {
                        bool taken = false;

                        foreach ( MessageBlock MessageBlock in world.Map.MessageBlocks ) {
                            if ( MessageBlock.Name.Equals( "MB" + world.Map.MessageBlockID ) ) {
                                taken = true;
                                break;
                            }
                        }

                        if ( !taken ) {
                            found = true;
                        } else {
                            world.Map.MessageBlockID++;
                        }
                    }

                    return "MB" + world.Map.MessageBlockID;
                }
            }

            return "MB1";
        }